| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 \ | 27 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
| 28 ; RUN: --command %p2i --filetype=asm --assemble \ | 28 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 29 ; RUN: --disassemble --target mips32 -i %s --args -O2 --skip-unimplemented \ | 29 ; RUN: --disassemble --target mips32 -i %s --args -O2 --skip-unimplemented \ |
| 30 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ | 30 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
| 31 ; RUN: --command FileCheck --check-prefix MIPS32 %s | 31 ; RUN: --command FileCheck --check-prefix MIPS32-O2 --check-prefix MIPS32 %s |
| 32 | 32 |
| 33 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ | 33 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
| 34 ; RUN: --command %p2i --filetype=asm --assemble \ | 34 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 35 ; RUN: --disassemble --target mips32 -i %s --args -Om1 --skip-unimplemented \ | 35 ; RUN: --disassemble --target mips32 -i %s --args -Om1 --skip-unimplemented \ |
| 36 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ | 36 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
| 37 ; RUN: --command FileCheck --check-prefix MIPS32 %s | 37 ; RUN: --command FileCheck --check-prefix MIPS32-OM1 --check-prefix MIPS32 %s |
| 38 | 38 |
| 39 @i1 = internal global [4 x i8] zeroinitializer, align 4 | 39 @i1 = internal global [4 x i8] zeroinitializer, align 4 |
| 40 @i2 = internal global [4 x i8] zeroinitializer, align 4 | 40 @i2 = internal global [4 x i8] zeroinitializer, align 4 |
| 41 @u1 = internal global [4 x i8] zeroinitializer, align 4 | 41 @u1 = internal global [4 x i8] zeroinitializer, align 4 |
| 42 | 42 |
| 43 define internal void @conv1() { | 43 define internal void @conv1() { |
| 44 entry: | 44 entry: |
| 45 %__0 = bitcast [4 x i8]* @u1 to i32* | 45 %__0 = bitcast [4 x i8]* @u1 to i32* |
| 46 %v0 = load i32, i32* %__0, align 1 | 46 %v0 = load i32, i32* %__0, align 1 |
| 47 %sext = shl i32 %v0, 24 | 47 %sext = shl i32 %v0, 24 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 ; MIPS32-LABEL: ashrImmNeg | 142 ; MIPS32-LABEL: ashrImmNeg |
| 143 ; MIPS32: srav | 143 ; MIPS32: srav |
| 144 | 144 |
| 145 define internal i64 @shlImm64One(i64 %val) { | 145 define internal i64 @shlImm64One(i64 %val) { |
| 146 entry: | 146 entry: |
| 147 %result = shl i64 %val, 1 | 147 %result = shl i64 %val, 1 |
| 148 ret i64 %result | 148 ret i64 %result |
| 149 } | 149 } |
| 150 ; CHECK-LABEL: shlImm64One | 150 ; CHECK-LABEL: shlImm64One |
| 151 ; CHECK: shl {{.*}},1 | 151 ; CHECK: shl {{.*}},1 |
| 152 ; MIPS32-LABEL: shlImm64One |
| 153 ; MIPS32: addu [[T_LO:.*]],[[VAL_LO:.*]],[[VAL_LO]] |
| 154 ; MIPS32: sltu [[T1:.*]],[[T_LO]],[[VAL_LO]] |
| 155 ; MIPS32: addu [[T2:.*]],[[T1]],[[VAL_HI:.*]] |
| 156 ; MIPS32: addu {{.*}},[[VAL_HI]],[[T2]] |
| 152 | 157 |
| 153 define internal i64 @shlImm64LessThan32(i64 %val) { | 158 define internal i64 @shlImm64LessThan32(i64 %val) { |
| 154 entry: | 159 entry: |
| 155 %result = shl i64 %val, 4 | 160 %result = shl i64 %val, 4 |
| 156 ret i64 %result | 161 ret i64 %result |
| 157 } | 162 } |
| 158 ; CHECK-LABEL: shlImm64LessThan32 | 163 ; CHECK-LABEL: shlImm64LessThan32 |
| 159 ; CHECK: shl {{.*}},0x4 | 164 ; CHECK: shl {{.*}},0x4 |
| 165 ; MIPS32-LABEL: shlImm64LessThan32 |
| 166 ; MIPS32: srl [[T1:.*]],[[VAL_LO:.*]],0x1c |
| 167 ; MIPS32: sll [[T2:.*]],{{.*}},0x4 |
| 168 ; MIPS32: or {{.*}},[[T1]],[[T2]] |
| 169 ; MIPS32: sll {{.*}},[[VAL_LO]],0x4 |
| 160 | 170 |
| 161 define internal i64 @shlImm64Equal32(i64 %val) { | 171 define internal i64 @shlImm64Equal32(i64 %val) { |
| 162 entry: | 172 entry: |
| 163 %result = shl i64 %val, 32 | 173 %result = shl i64 %val, 32 |
| 164 ret i64 %result | 174 ret i64 %result |
| 165 } | 175 } |
| 166 ; CHECK-LABEL: shlImm64Equal32 | 176 ; CHECK-LABEL: shlImm64Equal32 |
| 167 ; CHECK-NOT: shl | 177 ; CHECK-NOT: shl |
| 178 ; MIPS32-LABEL: shlImm64Equal32 |
| 179 ; MIPS32: li {{.*}},0 |
| 180 ; MIPS32-O2: move |
| 181 ; MIPS32-OM1: sw |
| 182 ; MIPS32-OM1: lw |
| 168 | 183 |
| 169 define internal i64 @shlImm64GreaterThan32(i64 %val) { | 184 define internal i64 @shlImm64GreaterThan32(i64 %val) { |
| 170 entry: | 185 entry: |
| 171 %result = shl i64 %val, 40 | 186 %result = shl i64 %val, 40 |
| 172 ret i64 %result | 187 ret i64 %result |
| 173 } | 188 } |
| 174 ; CHECK-LABEL: shlImm64GreaterThan32 | 189 ; CHECK-LABEL: shlImm64GreaterThan32 |
| 175 ; CHECK: shl {{.*}},0x8 | 190 ; CHECK: shl {{.*}},0x8 |
| 191 ; MIPS32-LABEL: shlImm64GreaterThan32 |
| 192 ; MIPS32: sll {{.*}},{{.*}},0x8 |
| 193 ; MIPS32: li {{.*}},0 |
| 176 | 194 |
| 177 define internal i64 @lshrImm64One(i64 %val) { | 195 define internal i64 @lshrImm64One(i64 %val) { |
| 178 entry: | 196 entry: |
| 179 %result = lshr i64 %val, 1 | 197 %result = lshr i64 %val, 1 |
| 180 ret i64 %result | 198 ret i64 %result |
| 181 } | 199 } |
| 182 ; CHECK-LABEL: lshrImm64One | 200 ; CHECK-LABEL: lshrImm64One |
| 183 ; CHECK: shr {{.*}},1 | 201 ; CHECK: shr {{.*}},1 |
| 202 ; MIPS32-LABEL: lshrImm64One |
| 203 ; MIPS32: sll [[T1:.*]],[[VAL_HI:.*]],0x1f |
| 204 ; MIPS32: srl [[T2:.*]],{{.*}},0x1 |
| 205 ; MIPS32: or {{.*}},[[T1]],[[T2]] |
| 206 ; MIPS32: srl {{.*}},[[VAL_HI]],0x1 |
| 184 | 207 |
| 185 define internal i64 @lshrImm64LessThan32(i64 %val) { | 208 define internal i64 @lshrImm64LessThan32(i64 %val) { |
| 186 entry: | 209 entry: |
| 187 %result = lshr i64 %val, 4 | 210 %result = lshr i64 %val, 4 |
| 188 ret i64 %result | 211 ret i64 %result |
| 189 } | 212 } |
| 190 ; CHECK-LABEL: lshrImm64LessThan32 | 213 ; CHECK-LABEL: lshrImm64LessThan32 |
| 191 ; CHECK: shrd {{.*}},0x4 | 214 ; CHECK: shrd {{.*}},0x4 |
| 192 ; CHECK: shr {{.*}},0x4 | 215 ; CHECK: shr {{.*}},0x4 |
| 216 ; MIPS32-LABEL: lshrImm64LessThan32 |
| 217 ; MIPS32: sll [[T1:.*]],[[VAL_HI:.*]],0x1c |
| 218 ; MIPS32: srl [[T2:.*]],{{.*}},0x4 |
| 219 ; MIPS32: or {{.*}},[[T1]],[[T2]] |
| 220 ; MIPS32: srl {{.*}},[[VAL_HI]],0x4 |
| 193 | 221 |
| 194 define internal i64 @lshrImm64Equal32(i64 %val) { | 222 define internal i64 @lshrImm64Equal32(i64 %val) { |
| 195 entry: | 223 entry: |
| 196 %result = lshr i64 %val, 32 | 224 %result = lshr i64 %val, 32 |
| 197 ret i64 %result | 225 ret i64 %result |
| 198 } | 226 } |
| 199 ; CHECK-LABEL: lshrImm64Equal32 | 227 ; CHECK-LABEL: lshrImm64Equal32 |
| 200 ; CHECK-NOT: shr | 228 ; CHECK-NOT: shr |
| 229 ; MIPS32-LABEL: lshrImm64Equal32 |
| 230 ; MIPS32: li {{.*}},0 |
| 231 ; MIPS32-O2: move |
| 232 ; MIPS32-OM1: sw |
| 233 ; MIPS32-OM1: lw |
| 201 | 234 |
| 202 define internal i64 @lshrImm64GreaterThan32(i64 %val) { | 235 define internal i64 @lshrImm64GreaterThan32(i64 %val) { |
| 203 entry: | 236 entry: |
| 204 %result = lshr i64 %val, 40 | 237 %result = lshr i64 %val, 40 |
| 205 ret i64 %result | 238 ret i64 %result |
| 206 } | 239 } |
| 207 ; CHECK-LABEL: lshrImm64GreaterThan32 | 240 ; CHECK-LABEL: lshrImm64GreaterThan32 |
| 208 ; CHECK-NOT: shrd | 241 ; CHECK-NOT: shrd |
| 209 ; CHECK: shr {{.*}},0x8 | 242 ; CHECK: shr {{.*}},0x8 |
| 243 ; MIPS32-LABEL: lshrImm64GreaterThan32 |
| 244 ; MIPS32: srl {{.*}},{{.*}},0x8 |
| 245 ; MIPS32: li {{.*}},0 |
| 210 | 246 |
| 211 define internal i64 @ashrImm64One(i64 %val) { | 247 define internal i64 @ashrImm64One(i64 %val) { |
| 212 entry: | 248 entry: |
| 213 %result = ashr i64 %val, 1 | 249 %result = ashr i64 %val, 1 |
| 214 ret i64 %result | 250 ret i64 %result |
| 215 } | 251 } |
| 216 ; CHECK-LABEL: ashrImm64One | 252 ; CHECK-LABEL: ashrImm64One |
| 217 ; CHECK: shrd {{.*}},0x1 | 253 ; CHECK: shrd {{.*}},0x1 |
| 218 ; CHECK: sar {{.*}},1 | 254 ; CHECK: sar {{.*}},1 |
| 255 ; MIPS32-LABEL: ashrImm64One |
| 256 ; MIPS32: sll [[T1:.*]],[[VAL_HI:.*]],0x1f |
| 257 ; MIPS32: srl [[T2:.*]],{{.*}},0x1 |
| 258 ; MIPS32: or {{.*}},[[T1]],[[T2]] |
| 259 ; MIPS32: sra {{.*}},[[VAL_HI]],0x1 |
| 219 | 260 |
| 220 define internal i64 @ashrImm64LessThan32(i64 %val) { | 261 define internal i64 @ashrImm64LessThan32(i64 %val) { |
| 221 entry: | 262 entry: |
| 222 %result = ashr i64 %val, 4 | 263 %result = ashr i64 %val, 4 |
| 223 ret i64 %result | 264 ret i64 %result |
| 224 } | 265 } |
| 225 ; CHECK-LABEL: ashrImm64LessThan32 | 266 ; CHECK-LABEL: ashrImm64LessThan32 |
| 226 ; CHECK: shrd {{.*}},0x4 | 267 ; CHECK: shrd {{.*}},0x4 |
| 227 ; CHECK: sar {{.*}},0x4 | 268 ; CHECK: sar {{.*}},0x4 |
| 269 ; MIPS32-LABEL: ashrImm64LessThan32 |
| 270 ; MIPS32: sll [[T1:.*]],[[VAL_HI:.*]],0x1c |
| 271 ; MIPS32: srl [[T2:.*]],{{.*}},0x4 |
| 272 ; MIPS32: or {{.*}},[[T1]],[[T2]] |
| 273 ; MIPS32: sra {{.*}},[[VAL_HI]],0x4 |
| 228 | 274 |
| 229 define internal i64 @ashrImm64Equal32(i64 %val) { | 275 define internal i64 @ashrImm64Equal32(i64 %val) { |
| 230 entry: | 276 entry: |
| 231 %result = ashr i64 %val, 32 | 277 %result = ashr i64 %val, 32 |
| 232 ret i64 %result | 278 ret i64 %result |
| 233 } | 279 } |
| 234 ; CHECK-LABEL: ashrImm64Equal32 | 280 ; CHECK-LABEL: ashrImm64Equal32 |
| 235 ; CHECK: sar {{.*}},0x1f | 281 ; CHECK: sar {{.*}},0x1f |
| 236 ; CHECK-NOT: shrd | 282 ; CHECK-NOT: shrd |
| 283 ; MIPS32-LABEL: ashrImm64Equal32 |
| 284 ; MIPS32: sra {{.*}},[[VAL_HI:.*]],0x1f |
| 285 ; MIPS32-O2: move {{.*}},[[VAL_HI]] |
| 286 ; MIPS32-OM1: sw [[VAL_HI]],{{.*}} |
| 287 ; MIPS32-OM1: lw {{.*}},{{.*}} |
| 237 | 288 |
| 238 define internal i64 @ashrImm64GreaterThan32(i64 %val) { | 289 define internal i64 @ashrImm64GreaterThan32(i64 %val) { |
| 239 entry: | 290 entry: |
| 240 %result = ashr i64 %val, 40 | 291 %result = ashr i64 %val, 40 |
| 241 ret i64 %result | 292 ret i64 %result |
| 242 } | 293 } |
| 243 ; CHECK-LABEL: ashrImm64GreaterThan32 | 294 ; CHECK-LABEL: ashrImm64GreaterThan32 |
| 244 ; CHECK: sar {{.*}},0x1f | 295 ; CHECK: sar {{.*}},0x1f |
| 245 ; CHECK: shrd {{.*}},0x8 | 296 ; CHECK: shrd {{.*}},0x8 |
| 297 ; MIPS32-LABEL: ashrImm64GreaterThan32 |
| 298 ; MIPS32: sra {{.*}},[[VAL_HI:.*]],0x8 |
| 299 ; MIPS32: sra {{.*}},[[VAL_HI]],0x1f |
| OLD | NEW |