summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-04-14 07:13:24 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-04-14 07:13:24 +0000
commit0f26b0aeb4a91418d4c273bb25ab22f3b416a960 (patch)
treef4a1cfadf86bfb6a4a6aa20c9df02cea75ebfbef /llvm/test/CodeGen/ARM
parentd871531687b062862234a3346b50f1824e27ed3b (diff)
downloadbcm5719-llvm-0f26b0aeb4a91418d4c273bb25ab22f3b416a960.tar.gz
bcm5719-llvm-0f26b0aeb4a91418d4c273bb25ab22f3b416a960.zip
[CodeGen] Teach LLVM how to lower @llvm.{min,max}num to {MIN,MAX}NAN
The behavior of {MIN,MAX}NAN differs from that of {MIN,MAX}NUM when only one of the inputs is NaN: -NUM will return the non-NaN argument while -NAN would return NaN. It is desirable to lower to @llvm.{min,max}num to -NAN if they don't have a native instruction for -NUM. Notably, ARMv7 NEON's vmin has the -NAN semantics. N.B. Of course, it is only safe to do this if the intrinsic call is marked nnan. llvm-svn: 266279
Diffstat (limited to 'llvm/test/CodeGen/ARM')
-rw-r--r--llvm/test/CodeGen/ARM/vminmax.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/vminmax.ll b/llvm/test/CodeGen/ARM/vminmax.ll
index 011bfd7ff88..e4f30faa917 100644
--- a/llvm/test/CodeGen/ARM/vminmax.ll
+++ b/llvm/test/CodeGen/ARM/vminmax.ll
@@ -291,3 +291,20 @@ declare <8 x i16> @llvm.arm.neon.vmaxu.v8i16(<8 x i16>, <8 x i16>) nounwind read
declare <4 x i32> @llvm.arm.neon.vmaxu.v4i32(<4 x i32>, <4 x i32>) nounwind readnone
declare <4 x float> @llvm.arm.neon.vmaxs.v4f32(<4 x float>, <4 x float>) nounwind readnone
+
+declare float @llvm.maxnum.f32(float %a, float %b)
+declare float @llvm.minnum.f32(float %a, float %b)
+
+define float @maxnum(float %a, float %b) {
+;CHECK-LABEL: maxnum:
+;CHECK: vmax.f32
+ %r = call nnan float @llvm.maxnum.f32(float %a, float %b)
+ ret float %r
+}
+
+define float @minnum(float %a, float %b) {
+;CHECK-LABEL: minnum:
+;CHECK: vmin.f32
+ %r = call nnan float @llvm.minnum.f32(float %a, float %b)
+ ret float %r
+}
OpenPOWER on IntegriCloud