[llvm] r299756 - [ARM] GlobalISel: Support frem for 64-bit values
Diana Picus via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 7 03:50:02 PDT 2017
Author: rovka
Date: Fri Apr 7 05:50:02 2017
New Revision: 299756
URL: http://llvm.org/viewvc/llvm-project?rev=299756&view=rev
Log:
[ARM] GlobalISel: Support frem for 64-bit values
Legalize to a libcall.
Modified:
llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp
llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel-fp.ll
llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-fp.mir
Modified: llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp?rev=299756&r1=299755&r2=299756&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp Fri Apr 7 05:50:02 2017
@@ -66,6 +66,7 @@ ARMLegalizerInfo::ARMLegalizerInfo(const
}
setAction({G_FREM, s32}, Libcall);
+ setAction({G_FREM, s64}, Libcall);
computeTables();
}
Modified: llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel-fp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel-fp.ll?rev=299756&r1=299755&r2=299756&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel-fp.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel-fp.ll Fri Apr 7 05:50:02 2017
@@ -9,3 +9,9 @@ define arm_aapcscc float @test_frem_floa
ret float %r
}
+define arm_aapcscc double @test_frem_double(double %x, double %y) {
+; CHECK-LABEL: test_frem_double:
+; CHECK: blx fmod
+ %r = frem double %x, %y
+ ret double %r
+}
Modified: llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-fp.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-fp.mir?rev=299756&r1=299755&r2=299756&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-fp.mir (original)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-fp.mir Fri Apr 7 05:50:02 2017
@@ -3,6 +3,7 @@
# RUN: llc -mtriple arm-- -float-abi=soft -global-isel -run-pass=legalizer %s -o - | FileCheck %s
--- |
define void @test_frem_float() { ret void }
+ define void @test_frem_double() { ret void }
...
---
name: test_frem_float
@@ -35,3 +36,54 @@ body: |
%r0 = COPY %2(s32)
BX_RET 14, _, implicit %r0
...
+---
+name: test_frem_double
+# CHECK-LABEL: name: test_frem_double
+legalized: false
+# CHECK: legalized: true
+regBankSelected: false
+selected: false
+tracksRegLiveness: true
+registers:
+ - { id: 0, class: _ }
+ - { id: 1, class: _ }
+ - { id: 2, class: _ }
+ - { id: 3, class: _ }
+ - { id: 4, class: _ }
+ - { id: 5, class: _ }
+ - { id: 6, class: _ }
+ - { id: 7, class: _ }
+ - { id: 8, class: _ }
+body: |
+ bb.0:
+ liveins: %r0, %r1, %r2, %r3
+
+ ; The inputs may be in the wrong order (depending on the target's
+ ; endianness), but that's orthogonal to what we're trying to test here. We
+ ; only need to check that the first value, received through R0-R1, ends up
+ ; in R0-R1 or R1-R0, and the second value, received through R2-R3, ends up
+ ; in R2-R3 or R3-R2, when passed to fmod.
+ ; CHECK-DAG: [[X0:%[0-9]+]](s32) = COPY %r0
+ ; CHECK-DAG: [[X1:%[0-9]+]](s32) = COPY %r1
+ ; CHECK-DAG: [[Y0:%[0-9]+]](s32) = COPY %r2
+ ; CHECK-DAG: [[Y1:%[0-9]+]](s32) = COPY %r3
+ %0(s32) = COPY %r0
+ %1(s32) = COPY %r1
+ %2(s32) = COPY %r2
+ %3(s32) = COPY %r3
+ %4(s64) = G_SEQUENCE %0(s32), 0, %1(s32), 32
+ %5(s64) = G_SEQUENCE %2(s32), 0, %3(s32), 32
+ ; CHECK: ADJCALLSTACKDOWN
+ ; CHECK-DAG: %r{{[0-1]}} = COPY [[X0]]
+ ; CHECK-DAG: %r{{[0-1]}} = COPY [[X1]]
+ ; CHECK-DAG: %r{{[2-3]}} = COPY [[Y0]]
+ ; CHECK-DAG: %r{{[2-3]}} = COPY [[Y1]]
+ ; CHECK: BLX $fmod, {{.*}}, implicit %r0, implicit %r1, implicit %r2, implicit %r3, implicit-def %r0, implicit-def %r1
+ ; CHECK: ADJCALLSTACKUP
+ %6(s64) = G_FREM %4, %5
+ %7(s32) = G_EXTRACT %6(s64), 0
+ %8(s32) = G_EXTRACT %6(s64), 32
+ %r0 = COPY %7(s32)
+ %r1 = COPY %8(s32)
+ BX_RET 14, _, implicit %r0, implicit %r1
+...
More information about the llvm-commits
mailing list