OLD | NEW |
(Empty) | |
| 1 ; Test of global initializers. |
| 2 |
| 3 ; RUN: %llvm2ice --verbose inst %s | FileCheck %s |
| 4 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 5 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 6 |
| 7 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 |
| 8 ; CHECK: .data |
| 9 ; CHECK-NEXT: .align 4 |
| 10 ; CHECK-NEXT: PrimitiveInit: |
| 11 ; CHECK-NEXT: .byte |
| 12 ; CHECK: .size PrimitiveInit, 4 |
| 13 |
| 14 @PrimitiveInitConst = internal constant [4 x i8] c"\0D\00\00\00", align 4 |
| 15 ; CHECK: .section .rodata,"a",@progbits |
| 16 ; CHECK-NEXT: .align 4 |
| 17 ; CHECK-NEXT: PrimitiveInitConst: |
| 18 ; CHECK-NEXT: .byte |
| 19 ; CHECK: .size PrimitiveInitConst, 4 |
| 20 |
| 21 @ArrayInit = internal global [20 x i8] c"\0A\00\00\00\14\00\00\00\1E\00\00\00(\0
0\00\002\00\00\00", align 4 |
| 22 ; CHECK: .data |
| 23 ; CHECK-NEXT: .align 4 |
| 24 ; CHECK-NEXT: ArrayInit: |
| 25 ; CHECK-NEXT: .byte |
| 26 ; CHECK: .size ArrayInit, 20 |
| 27 |
| 28 @ArrayInitPartial = internal global [40 x i8] c"<\00\00\00F\00\00\00P\00\00\00Z\
00\00\00d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00",
align 4 |
| 29 ; CHECK: .data |
| 30 ; CHECK-NEXT: .align 4 |
| 31 ; CHECK-NEXT: ArrayInitPartial: |
| 32 ; CHECK-NEXT: .byte |
| 33 ; CHECK: .size ArrayInitPartial, 40 |
| 34 |
| 35 @PrimitiveInitStatic = internal global [4 x i8] zeroinitializer, align 4 |
| 36 ; CHECK: .data |
| 37 ; CHECK-NEXT: .comm PrimitiveInitStatic, 4, 4 |
| 38 ; CHECK-NEXT: .local PrimitiveInitStatic |
| 39 |
| 40 @PrimitiveUninit = internal global [4 x i8] zeroinitializer, align 4 |
| 41 ; CHECK: .data |
| 42 ; CHECK-NEXT: .comm PrimitiveUninit, 4, 4 |
| 43 ; CHECK-NEXT: .local PrimitiveUninit |
| 44 |
| 45 @ArrayUninit = internal global [20 x i8] zeroinitializer, align 4 |
| 46 ; CHECK: .data |
| 47 ; CHECK-NEXT: .comm ArrayUninit, 20, 4 |
| 48 ; CHECK-NEXT: .local ArrayUninit |
| 49 |
| 50 @ArrayUninitConstDouble = internal constant [200 x i8] zeroinitializer, align 8 |
| 51 ; CHECK: .section .rodata,"a",@progbits |
| 52 ; CHECK-NEXT: .align 8 |
| 53 ; CHECK-NEXT: ArrayUninitConstDouble: |
| 54 ; CHECK-NEXT: .zero 200 |
| 55 ; CHECK-NEXT: .size ArrayUninitConstDouble, 200 |
| 56 |
| 57 @ArrayUninitConstInt = internal constant [20 x i8] zeroinitializer, align 4 |
| 58 ; CHECK: .section .rodata,"a",@progbits |
| 59 ; CHECK-NEXT: .align 4 |
| 60 ; CHECK-NEXT: ArrayUninitConstInt: |
| 61 ; CHECK-NEXT: .zero 20 |
| 62 ; CHECK-NEXT: .size ArrayUninitConstInt, 20 |
| 63 |
| 64 @__init_array_start = internal constant [0 x i8] zeroinitializer, align 4 |
| 65 @__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4 |
| 66 @__tls_template_start = internal constant [0 x i8] zeroinitializer, align 8 |
| 67 @__tls_template_alignment = internal constant [4 x i8] c"\01\00\00\00", align 4 |
| 68 |
| 69 define internal i32 @main(i32 %argc, i32 %argv) { |
| 70 entry: |
| 71 %expanded1 = ptrtoint [4 x i8]* @PrimitiveInit to i32 |
| 72 call void @use(i32 %expanded1) |
| 73 %expanded3 = ptrtoint [4 x i8]* @PrimitiveInitConst to i32 |
| 74 call void @use(i32 %expanded3) |
| 75 %expanded5 = ptrtoint [4 x i8]* @PrimitiveInitStatic to i32 |
| 76 call void @use(i32 %expanded5) |
| 77 %expanded7 = ptrtoint [4 x i8]* @PrimitiveUninit to i32 |
| 78 call void @use(i32 %expanded7) |
| 79 %expanded9 = ptrtoint [20 x i8]* @ArrayInit to i32 |
| 80 call void @use(i32 %expanded9) |
| 81 %expanded11 = ptrtoint [40 x i8]* @ArrayInitPartial to i32 |
| 82 call void @use(i32 %expanded11) |
| 83 %expanded13 = ptrtoint [20 x i8]* @ArrayUninit to i32 |
| 84 call void @use(i32 %expanded13) |
| 85 ret i32 0 |
| 86 } |
| 87 ; CHECK: entry: |
| 88 |
| 89 declare void @use(i32) |
| 90 |
| 91 define internal i32 @nacl_tp_tdb_offset(i32 %__0) { |
| 92 entry: |
| 93 ret i32 0 |
| 94 } |
| 95 |
| 96 define internal i32 @nacl_tp_tls_offset(i32 %size) { |
| 97 entry: |
| 98 %result = sub i32 0, %size |
| 99 ret i32 %result |
| 100 } |
| 101 |
| 102 ; ERRORS-NOT: ICE translation error |
| 103 ; DUMP-NOT: SZ |
OLD | NEW |