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: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 4 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
5 ; RUN: --target x8632 -i %s --args -O2 \ | 5 ; RUN: --target x8632 -i %s --args -O2 \ |
6 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 6 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
7 | 7 |
8 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 8 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
9 ; RUN: --target x8632 -i %s --args -Om1 \ | 9 ; RUN: --target x8632 -i %s --args -Om1 \ |
10 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 10 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
11 | 11 |
12 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) | 12 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) |
13 ; once enough infrastructure is in. Also, switch to --filetype=obj | 13 ; once enough infrastructure is in. Also, switch to --filetype=obj |
14 ; when possible. | 14 ; when possible. |
15 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 15 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
16 ; RUN: --command %p2i --filetype=asm --assemble \ | 16 ; RUN: --command %p2i --filetype=asm --assemble \ |
17 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ | 17 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ |
18 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 18 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
19 ; RUN: --command FileCheck --check-prefix ARM32 %s | 19 ; RUN: --command FileCheck --check-prefix ARM32 %s |
20 | 20 |
21 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 21 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
22 ; RUN: --command %p2i --filetype=asm --assemble \ | 22 ; RUN: --command %p2i --filetype=asm --assemble \ |
23 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ | 23 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ |
24 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 24 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
25 ; RUN: --command FileCheck --check-prefix ARM32 %s | 25 ; RUN: --command FileCheck --check-prefix ARM32 %s |
26 | 26 |
| 27 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
| 28 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 29 ; RUN: --disassemble --target mips32 -i %s --args -O2 --skip-unimplemented \ |
| 30 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
| 31 ; RUN: --command FileCheck --check-prefix MIPS32 %s |
| 32 |
| 33 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
| 34 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 35 ; RUN: --disassemble --target mips32 -i %s --args -Om1 --skip-unimplemented \ |
| 36 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
| 37 ; RUN: --command FileCheck --check-prefix MIPS32 %s |
27 | 38 |
28 @i1 = internal global [4 x i8] zeroinitializer, align 4 | 39 @i1 = internal global [4 x i8] zeroinitializer, align 4 |
29 @i2 = internal global [4 x i8] zeroinitializer, align 4 | 40 @i2 = internal global [4 x i8] zeroinitializer, align 4 |
30 @u1 = internal global [4 x i8] zeroinitializer, align 4 | 41 @u1 = internal global [4 x i8] zeroinitializer, align 4 |
31 | 42 |
32 define internal void @conv1() { | 43 define internal void @conv1() { |
33 entry: | 44 entry: |
34 %__0 = bitcast [4 x i8]* @u1 to i32* | 45 %__0 = bitcast [4 x i8]* @u1 to i32* |
35 %v0 = load i32, i32* %__0, align 1 | 46 %v0 = load i32, i32* %__0, align 1 |
36 %sext = shl i32 %v0, 24 | 47 %sext = shl i32 %v0, 24 |
(...skipping 29 matching lines...) Expand all Loading... |
66 ; ARM32: lsr {{.*}}, #16 | 77 ; ARM32: lsr {{.*}}, #16 |
67 | 78 |
68 define internal i32 @shlImmLarge(i32 %val) { | 79 define internal i32 @shlImmLarge(i32 %val) { |
69 entry: | 80 entry: |
70 %result = shl i32 %val, 257 | 81 %result = shl i32 %val, 257 |
71 ret i32 %result | 82 ret i32 %result |
72 } | 83 } |
73 ; CHECK-LABEL: shlImmLarge | 84 ; CHECK-LABEL: shlImmLarge |
74 ; CHECK: shl {{.*}},0x1 | 85 ; CHECK: shl {{.*}},0x1 |
75 | 86 |
| 87 ; MIPS32-LABEL: shlImmLarge |
| 88 ; MIPS32: sllv |
| 89 |
76 define internal i32 @shlImmNeg(i32 %val) { | 90 define internal i32 @shlImmNeg(i32 %val) { |
77 entry: | 91 entry: |
78 %result = shl i32 %val, -1 | 92 %result = shl i32 %val, -1 |
79 ret i32 %result | 93 ret i32 %result |
80 } | 94 } |
81 ; CHECK-LABEL: shlImmNeg | 95 ; CHECK-LABEL: shlImmNeg |
82 ; CHECK: shl {{.*}},0xff | 96 ; CHECK: shl {{.*}},0xff |
83 | 97 |
| 98 ; MIPS32-LABEL: shlImmNeg |
| 99 ; MIPS32: sllv |
| 100 |
84 define internal i32 @lshrImmLarge(i32 %val) { | 101 define internal i32 @lshrImmLarge(i32 %val) { |
85 entry: | 102 entry: |
86 %result = lshr i32 %val, 257 | 103 %result = lshr i32 %val, 257 |
87 ret i32 %result | 104 ret i32 %result |
88 } | 105 } |
89 ; CHECK-LABEL: lshrImmLarge | 106 ; CHECK-LABEL: lshrImmLarge |
90 ; CHECK: shr {{.*}},0x1 | 107 ; CHECK: shr {{.*}},0x1 |
91 | 108 |
| 109 ; MIPS32-LABEL: lshrImmLarge |
| 110 ; MIPS32: srlv |
| 111 |
92 define internal i32 @lshrImmNeg(i32 %val) { | 112 define internal i32 @lshrImmNeg(i32 %val) { |
93 entry: | 113 entry: |
94 %result = lshr i32 %val, -1 | 114 %result = lshr i32 %val, -1 |
95 ret i32 %result | 115 ret i32 %result |
96 } | 116 } |
97 ; CHECK-LABEL: lshrImmNeg | 117 ; CHECK-LABEL: lshrImmNeg |
98 ; CHECK: shr {{.*}},0xff | 118 ; CHECK: shr {{.*}},0xff |
99 | 119 |
| 120 ; MIPS32-LABEL: lshrImmNeg |
| 121 ; MIPS32: srlv |
| 122 |
100 define internal i32 @ashrImmLarge(i32 %val) { | 123 define internal i32 @ashrImmLarge(i32 %val) { |
101 entry: | 124 entry: |
102 %result = ashr i32 %val, 257 | 125 %result = ashr i32 %val, 257 |
103 ret i32 %result | 126 ret i32 %result |
104 } | 127 } |
105 ; CHECK-LABEL: ashrImmLarge | 128 ; CHECK-LABEL: ashrImmLarge |
106 ; CHECK: sar {{.*}},0x1 | 129 ; CHECK: sar {{.*}},0x1 |
107 | 130 |
| 131 ; MIPS32-LABEL: ashrImmLarge |
| 132 ; MIPS32: srav |
| 133 |
108 define internal i32 @ashrImmNeg(i32 %val) { | 134 define internal i32 @ashrImmNeg(i32 %val) { |
109 entry: | 135 entry: |
110 %result = ashr i32 %val, -1 | 136 %result = ashr i32 %val, -1 |
111 ret i32 %result | 137 ret i32 %result |
112 } | 138 } |
113 ; CHECK-LABEL: ashrImmNeg | 139 ; CHECK-LABEL: ashrImmNeg |
114 ; CHECK: sar {{.*}},0xff | 140 ; CHECK: sar {{.*}},0xff |
115 | 141 |
| 142 ; MIPS32-LABEL: ashrImmNeg |
| 143 ; MIPS32: srav |
| 144 |
116 define internal i64 @shlImm64One(i64 %val) { | 145 define internal i64 @shlImm64One(i64 %val) { |
117 entry: | 146 entry: |
118 %result = shl i64 %val, 1 | 147 %result = shl i64 %val, 1 |
119 ret i64 %result | 148 ret i64 %result |
120 } | 149 } |
121 ; CHECK-LABEL: shlImm64One | 150 ; CHECK-LABEL: shlImm64One |
122 ; CHECK: shl {{.*}},1 | 151 ; CHECK: shl {{.*}},1 |
123 | 152 |
124 define internal i64 @shlImm64LessThan32(i64 %val) { | 153 define internal i64 @shlImm64LessThan32(i64 %val) { |
125 entry: | 154 entry: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 ; CHECK-NOT: shrd | 236 ; CHECK-NOT: shrd |
208 | 237 |
209 define internal i64 @ashrImm64GreaterThan32(i64 %val) { | 238 define internal i64 @ashrImm64GreaterThan32(i64 %val) { |
210 entry: | 239 entry: |
211 %result = ashr i64 %val, 40 | 240 %result = ashr i64 %val, 40 |
212 ret i64 %result | 241 ret i64 %result |
213 } | 242 } |
214 ; CHECK-LABEL: ashrImm64GreaterThan32 | 243 ; CHECK-LABEL: ashrImm64GreaterThan32 |
215 ; CHECK: sar {{.*}},0x1f | 244 ; CHECK: sar {{.*}},0x1f |
216 ; CHECK: shrd {{.*}},0x8 | 245 ; CHECK: shrd {{.*}},0x8 |
OLD | NEW |