diff options
| author | Tim Northover <tnorthover@apple.com> | 2017-02-08 21:22:15 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2017-02-08 21:22:15 +0000 |
| commit | 0a9b27933a7aa84d04f133096727e94300dfc3be (patch) | |
| tree | 27d630b182d4572c3c0c832c646c34904559fc04 /llvm/test | |
| parent | 4a24705dd61e583c489349a4e2a87008ca68d16b (diff) | |
| download | bcm5719-llvm-0a9b27933a7aa84d04f133096727e94300dfc3be.tar.gz bcm5719-llvm-0a9b27933a7aa84d04f133096727e94300dfc3be.zip | |
GlobalISel: expand mul-with-overflow into mul-hi on AArch64.
AArch64 has specific instructions to multiply two numbers at double the width
and produce the high part of the result. These can be used to implement LLVM's
mul.with.overflow instructions fairly simply. Helps with C++ operator new[].
llvm-svn: 294519
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir index e56eef0bc4f..36726b7a30c 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir @@ -7,6 +7,7 @@ entry: ret void } + define void @test_mul_overflow() { ret void } ... --- @@ -35,3 +36,22 @@ body: | %5(s64) = G_ANYEXT %2 %x0 = COPY %5 ... + + +--- +name: test_mul_overflow +body: | + bb.0: + liveins: %x0, %x1, %w2, %w3 + + %0:_(s64) = COPY %x0 + %1:_(s64) = COPY %x1 + + ; CHECK-LABEL: name: test_mul_overflow + ; CHECK: %2(s64) = G_MUL %0, %1 + ; CHECK: [[HI:%[0-9]+]](s64) = G_SMULH %0, %1 + ; CHECK: [[ZERO:%[0-9]+]](s64) = G_CONSTANT i64 0 + ; CHECK: %3(s1) = G_ICMP intpred(ne), [[HI]](s64), [[ZERO]] + %2:_(s64), %3:_(s1) = G_SMULO %0, %1 + +... |

