OLD | NEW |
1 ; Trivial test of the use of internal versus external global | 1 ; Trivial test of the use of internal versus external global |
2 ; functions. | 2 ; variables. |
3 | 3 |
4 ; RUN: %llvm2ice --verbose inst %s | FileCheck %s | 4 ; RUN: %llvm2ice --verbose inst %s | FileCheck %s |
5 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 5 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
6 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 6 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
7 | 7 |
8 ; Note: We don't run this test using a PNaCl bitcode file, because | 8 @intern_global = internal global [4 x i8] c"\00\00\00\0C", align 4 |
9 ; external globals are not in the PNaCl ABI. | |
10 | |
11 @intern_global = global [4 x i8] [i8 0, i8 0, i8 0, i8 12], align 4 | |
12 @extern_global = external global [4 x i8] | 9 @extern_global = external global [4 x i8] |
13 | 10 |
14 define i32 @test_intern_global() { | 11 define i32 @test_intern_global() { |
15 ; CHECK: define i32 @test_intern_global | 12 ; CHECK: define i32 @test_intern_global |
16 entry: | 13 entry: |
17 %__1 = bitcast [4 x i8]* @intern_global to i32* | 14 %__1 = bitcast [4 x i8]* @intern_global to i32* |
18 %v0 = load i32* %__1, align 1 | 15 %v0 = load i32* %__1, align 1 |
19 ret i32 %v0 | 16 ret i32 %v0 |
20 } | 17 } |
21 | 18 |
22 define i32 @test_extern_global() { | 19 define i32 @test_extern_global() { |
23 ; CHECK: define i32 @test_extern_global | 20 ; CHECK: define i32 @test_extern_global |
24 entry: | 21 entry: |
25 %__1 = bitcast [4 x i8]* @extern_global to i32* | 22 %__1 = bitcast [4 x i8]* @extern_global to i32* |
26 %v0 = load i32* %__1, align 1 | 23 %v0 = load i32* %__1, align 1 |
27 ret i32 %v0 | 24 ret i32 %v0 |
28 } | 25 } |
29 | 26 |
30 ; ERRORS-NOT: ICE translation error | 27 ; ERRORS-NOT: ICE translation error |
31 ; DUMP-NOT: SZ | 28 ; DUMP-NOT: SZ |
OLD | NEW |