• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1RUN: llvm-opt-report -r %p %p/Inputs/sr2.yaml | FileCheck -strict-whitespace %s
2
3; CHECK: < {{.*[/\]}}sr2.c
4; CHECK-NEXT:  1         | /*
5; CHECK-NEXT:  2         | ** Write a 64-bit variable-length integer to memory starting at p[0].
6; CHECK-NEXT:  3         | ** The length of data write will be between 1 and 9 bytes.  The number
7; CHECK-NEXT:  4         | ** of bytes written is returned.
8; CHECK-NEXT:  5         | **
9; CHECK-NEXT:  6         | ** A variable-length integer consists of the lower 7 bits of each byte
10; CHECK-NEXT:  7         | ** for all bytes that have the 8th bit set and one byte with the 8th
11; CHECK-NEXT:  8         | ** bit clear.  Except, if we get to the 9th byte, it stores the full
12; CHECK-NEXT:  9         | ** 8 bits and is the last byte.
13; CHECK-NEXT: 10         | */
14; CHECK-NEXT: 11         | SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){
15; CHECK-NEXT: 12         |   int i, j, n;
16; CHECK-NEXT: 13         |   u8 buf[10];
17; CHECK-NEXT: 14         |   if( v & (((u64)0xff000000)<<32) ){
18; CHECK-NEXT: 15         |     p[8] = v;
19; CHECK-NEXT: 16         |     v >>= 8;
20; CHECK-NEXT: 17         |     for(i=7; i>=0; i--){
21; CHECK-NEXT: 18         |       p[i] = (v & 0x7f) | 0x80;
22; CHECK-NEXT: 19         |       v >>= 7;
23; CHECK-NEXT: 20         |     }
24; CHECK-NEXT: 21         |     return 9;
25; CHECK-NEXT: 22         |   }
26; CHECK-NEXT: 23         |   n = 0;
27; CHECK-NEXT: 24         |   do{
28; CHECK-NEXT: 25         |     buf[n++] = (v & 0x7f) | 0x80;
29; CHECK-NEXT: 26         |     v >>= 7;
30; CHECK-NEXT: 27         |   }while( v!=0 );
31; CHECK-NEXT: 28         |   buf[0] &= 0x7f;
32; CHECK-NEXT: 29         |   assert( n<=9 );
33; CHECK-NEXT: 30 U2V16,2 |   for(i=0, j=n-1; j>=0; j--, i++){
34; CHECK-NEXT: 31         |     p[i] = buf[j];
35; CHECK-NEXT: 32         |   }
36; CHECK-NEXT: 33         |   return n;
37; CHECK-NEXT: 34         | }
38; CHECK-NEXT: 35         |
39
40