OLD | NEW |
1 ; This is a test of C-level conversion operations that clang lowers | 1 ; This is a test of C-level conversion operations that clang lowers |
2 ; into pairs of shifts. | 2 ; into pairs of shifts. |
3 | 3 |
4 ; RUN: %p2i -i %s --filetype=obj --disassemble --no-local-syms --args -O2 \ | 4 ; RUN: %p2i -i %s --filetype=obj --disassemble --no-local-syms --args -O2 \ |
5 ; RUN: | FileCheck %s | 5 ; RUN: | FileCheck %s |
6 ; RUN: %p2i -i %s --filetype=obj --disassemble --no-local-syms --args -Om1 \ | 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --no-local-syms --args -Om1 \ |
7 ; RUN: | FileCheck %s | 7 ; RUN: | FileCheck %s |
8 | 8 |
9 @i1 = internal global [4 x i8] zeroinitializer, align 4 | 9 @i1 = internal global [4 x i8] zeroinitializer, align 4 |
10 @i2 = internal global [4 x i8] zeroinitializer, align 4 | 10 @i2 = internal global [4 x i8] zeroinitializer, align 4 |
11 @u1 = internal global [4 x i8] zeroinitializer, align 4 | 11 @u1 = internal global [4 x i8] zeroinitializer, align 4 |
12 | 12 |
13 define void @conv1() { | 13 define void @conv1() { |
14 entry: | 14 entry: |
15 %__0 = bitcast [4 x i8]* @u1 to i32* | 15 %__0 = bitcast [4 x i8]* @u1 to i32* |
16 %v0 = load i32* %__0, align 1 | 16 %v0 = load i32, i32* %__0, align 1 |
17 %sext = shl i32 %v0, 24 | 17 %sext = shl i32 %v0, 24 |
18 %v1 = ashr i32 %sext, 24 | 18 %v1 = ashr i32 %sext, 24 |
19 %__4 = bitcast [4 x i8]* @i1 to i32* | 19 %__4 = bitcast [4 x i8]* @i1 to i32* |
20 store i32 %v1, i32* %__4, align 1 | 20 store i32 %v1, i32* %__4, align 1 |
21 ret void | 21 ret void |
22 } | 22 } |
23 ; CHECK-LABEL: conv1 | 23 ; CHECK-LABEL: conv1 |
24 ; CHECK: shl {{.*}},0x18 | 24 ; CHECK: shl {{.*}},0x18 |
25 ; CHECK: sar {{.*}},0x18 | 25 ; CHECK: sar {{.*}},0x18 |
26 | 26 |
27 define void @conv2() { | 27 define void @conv2() { |
28 entry: | 28 entry: |
29 %__0 = bitcast [4 x i8]* @u1 to i32* | 29 %__0 = bitcast [4 x i8]* @u1 to i32* |
30 %v0 = load i32* %__0, align 1 | 30 %v0 = load i32, i32* %__0, align 1 |
31 %sext1 = shl i32 %v0, 16 | 31 %sext1 = shl i32 %v0, 16 |
32 %v1 = ashr i32 %sext1, 16 | 32 %v1 = ashr i32 %sext1, 16 |
33 %__4 = bitcast [4 x i8]* @i2 to i32* | 33 %__4 = bitcast [4 x i8]* @i2 to i32* |
34 store i32 %v1, i32* %__4, align 1 | 34 store i32 %v1, i32* %__4, align 1 |
35 ret void | 35 ret void |
36 } | 36 } |
37 ; CHECK-LABEL: conv2 | 37 ; CHECK-LABEL: conv2 |
38 ; CHECK: shl {{.*}},0x10 | 38 ; CHECK: shl {{.*}},0x10 |
39 ; CHECK: sar {{.*}},0x10 | 39 ; CHECK: sar {{.*}},0x10 |
OLD | NEW |