OLD | NEW |
1 ; RUIN: %llvm2ice -verbose inst %s | FileCheck %s | 1 ; This is a test of C-level conversion operations that clang lowers |
2 ; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 2 ; into pairs of shifts. |
| 3 |
| 4 ; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s |
| 6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
3 ; RUN: %szdiff --llvm2ice=%llvm2ice %s | FileCheck --check-prefix=DUMP %s | 7 ; RUN: %szdiff --llvm2ice=%llvm2ice %s | FileCheck --check-prefix=DUMP %s |
4 | 8 |
5 @i1 = common global i32 0, align 4 | 9 @i1 = common global i32 0, align 4 |
6 @i2 = common global i32 0, align 4 | 10 @i2 = common global i32 0, align 4 |
7 @u1 = common global i32 0, align 4 | 11 @u1 = common global i32 0, align 4 |
8 @u2 = common global i32 0, align 4 | 12 @u2 = common global i32 0, align 4 |
9 | 13 |
10 define void @conv1() { | 14 define void @conv1() { |
11 entry: | 15 entry: |
12 %v0 = load i32* @u1, align 1 | 16 %v0 = load i32* @u1, align 1 |
13 %sext = shl i32 %v0, 24 | 17 %sext = shl i32 %v0, 24 |
14 %v1 = ashr i32 %sext, 24 | 18 %v1 = ashr i32 %sext, 24 |
15 store i32 %v1, i32* @i1, align 1 | 19 store i32 %v1, i32* @i1, align 1 |
16 ret void | 20 ret void |
17 ; CHECK: shl eax, 24 | |
18 ; CHECK-NEXT: sar eax, 24 | |
19 } | 21 } |
| 22 ; CHECK: conv1: |
| 23 ; CHECK: shl {{.*}}, 24 |
| 24 ; CHECK: sar {{.*}}, 24 |
20 | 25 |
21 define void @conv2() { | 26 define void @conv2() { |
22 entry: | 27 entry: |
23 %v0 = load i32* @u1, align 1 | 28 %v0 = load i32* @u1, align 1 |
24 %sext1 = shl i32 %v0, 16 | 29 %sext1 = shl i32 %v0, 16 |
25 %v1 = ashr i32 %sext1, 16 | 30 %v1 = ashr i32 %sext1, 16 |
26 store i32 %v1, i32* @i2, align 1 | 31 store i32 %v1, i32* @i2, align 1 |
27 ret void | 32 ret void |
28 ; CHECK: shl eax, 16 | |
29 ; CHECK-NEXT: sar eax, 16 | |
30 } | 33 } |
| 34 ; CHECK: conv2: |
| 35 ; CHECK: shl {{.*}}, 16 |
| 36 ; CHECK: sar {{.*}}, 16 |
31 | 37 |
32 ; ERRORS-NOT: ICE translation error | 38 ; ERRORS-NOT: ICE translation error |
33 ; DUMP-NOT: SZ | 39 ; DUMP-NOT: SZ |
OLD | NEW |