| OLD | NEW |
| 1 ; Assembly test for simple arithmetic operations. | 1 ; Assembly test for simple arithmetic operations. |
| 2 | 2 |
| 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 4 ; RUN: --target x8632 -i %s --args -O2 \ | 4 ; RUN: --target x8632 -i %s --args -O2 \ |
| 5 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 5 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| 6 | 6 |
| 7 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) | 7 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) |
| 8 ; once enough infrastructure is in. Also, switch to --filetype=obj | 8 ; once enough infrastructure is in. Also, switch to --filetype=obj |
| 9 ; when possible. | 9 ; when possible. |
| 10 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 10 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 ; Check for a valid ARM mul instruction where operands have to be registers. | 110 ; Check for a valid ARM mul instruction where operands have to be registers. |
| 111 ; On the other hand x86-32 does allow an immediate. | 111 ; On the other hand x86-32 does allow an immediate. |
| 112 define internal i32 @MulImm(i32 %a, i32 %b) { | 112 define internal i32 @MulImm(i32 %a, i32 %b) { |
| 113 entry: | 113 entry: |
| 114 %mul = mul i32 %a, 99 | 114 %mul = mul i32 %a, 99 |
| 115 ret i32 %mul | 115 ret i32 %mul |
| 116 } | 116 } |
| 117 ; CHECK-LABEL: MulImm | 117 ; CHECK-LABEL: MulImm |
| 118 ; CHECK: imul e{{.*}},e{{.*}},0x63 | 118 ; CHECK: imul e{{.*}},e{{.*}},0x63 |
| 119 ; ARM32-LABEL: MulImm | 119 ; ARM32-LABEL: MulImm |
| 120 ; ARM32-OPTM1: movw {{.*}}, #99 | 120 ; ARM32-OPTM1: mov {{.*}}, #99 |
| 121 ; ARM32-OPTM1: mul r{{.*}}, r{{.*}}, r{{.*}} | 121 ; ARM32-OPTM1: mul r{{.*}}, r{{.*}}, r{{.*}} |
| 122 ; ARM32-OPT2: rsb [[T:r[0-9]+]], [[S:r[0-9]+]], [[S]], lsl #2 | 122 ; ARM32-OPT2: rsb [[T:r[0-9]+]], [[S:r[0-9]+]], [[S]], lsl #2 |
| 123 ; ARM32-OPT2-DAG: add [[T]], [[T]], [[S]], lsl #7 | 123 ; ARM32-OPT2-DAG: add [[T]], [[T]], [[S]], lsl #7 |
| 124 ; ARM32-OPT2-DAG: sub [[T]], [[T]], [[S]], lsl #5 | 124 ; ARM32-OPT2-DAG: sub [[T]], [[T]], [[S]], lsl #5 |
| 125 ; MIPS32-LABEL: MulImm | 125 ; MIPS32-LABEL: MulImm |
| 126 ; MIPS32: mul | 126 ; MIPS32: mul |
| 127 | 127 |
| 128 ; Check for a valid addressing mode in the x86-32 mul instruction when | 128 ; Check for a valid addressing mode in the x86-32 mul instruction when |
| 129 ; the second source operand is an immediate. | 129 ; the second source operand is an immediate. |
| 130 define internal i64 @MulImm64(i64 %a) { | 130 define internal i64 @MulImm64(i64 %a) { |
| 131 entry: | 131 entry: |
| 132 %mul = mul i64 %a, 99 | 132 %mul = mul i64 %a, 99 |
| 133 ret i64 %mul | 133 ret i64 %mul |
| 134 } | 134 } |
| 135 ; NOTE: the lowering is currently a bit inefficient for small 64-bit constants. | 135 ; NOTE: the lowering is currently a bit inefficient for small 64-bit constants. |
| 136 ; The top bits of the immediate are 0, but the instructions modeling that | 136 ; The top bits of the immediate are 0, but the instructions modeling that |
| 137 ; multiply by 0 are not eliminated (see expanded 64-bit ARM lowering). | 137 ; multiply by 0 are not eliminated (see expanded 64-bit ARM lowering). |
| 138 ; CHECK-LABEL: MulImm64 | 138 ; CHECK-LABEL: MulImm64 |
| 139 ; CHECK: mov {{.*}},0x63 | 139 ; CHECK: mov {{.*}},0x63 |
| 140 ; CHECK: mov {{.*}},0x0 | 140 ; CHECK: mov {{.*}},0x0 |
| 141 ; CHECK-NOT: mul {{[0-9]+}} | 141 ; CHECK-NOT: mul {{[0-9]+}} |
| 142 ; | 142 ; |
| 143 ; ARM32-LABEL: MulImm64 | 143 ; ARM32-LABEL: MulImm64 |
| 144 ; ARM32: movw {{.*}}, #99 | 144 ; ARM32: mov {{.*}}, #99 |
| 145 ; ARM32: movw {{.*}}, #0 | 145 ; ARM32: mov {{.*}}, #0 |
| 146 ; ARM32: mul r | 146 ; ARM32: mul r |
| 147 ; ARM32: mla r | 147 ; ARM32: mla r |
| 148 ; ARM32: umull r | 148 ; ARM32: umull r |
| 149 ; ARM32: add r | 149 ; ARM32: add r |
| 150 | 150 |
| 151 ; MIPS32-LABEL: MulImm64 | 151 ; MIPS32-LABEL: MulImm64 |
| 152 | 152 |
| 153 define internal i32 @Sdiv(i32 %a, i32 %b) { | 153 define internal i32 @Sdiv(i32 %a, i32 %b) { |
| 154 entry: | 154 entry: |
| 155 %div = sdiv i32 %a, %b | 155 %div = sdiv i32 %a, %b |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 ; CHECK: shr {{.*}},cl | 273 ; CHECK: shr {{.*}},cl |
| 274 | 274 |
| 275 define internal i32 @AshrReloc(i32 %a) { | 275 define internal i32 @AshrReloc(i32 %a) { |
| 276 entry: | 276 entry: |
| 277 %opnd = ptrtoint [4 x i8]* @G to i32 | 277 %opnd = ptrtoint [4 x i8]* @G to i32 |
| 278 %result = ashr i32 %a, %opnd | 278 %result = ashr i32 %a, %opnd |
| 279 ret i32 %result | 279 ret i32 %result |
| 280 } | 280 } |
| 281 ; CHECK-LABEL: AshrReloc | 281 ; CHECK-LABEL: AshrReloc |
| 282 ; CHECK: sar {{.*}},cl | 282 ; CHECK: sar {{.*}},cl |
| OLD | NEW |