[PATCH] D83937: [Power] Set the mayRaiseFPException for FCMPUS/FCMPUD

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 18:53:24 PDT 2020


steven.zhang updated this revision to Diff 290389.
steven.zhang added a comment.

Add test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83937/new/

https://reviews.llvm.org/D83937

Files:
  llvm/lib/Target/PowerPC/PPCInstrInfo.td
  llvm/test/CodeGen/PowerPC/nofpexcept.ll


Index: llvm/test/CodeGen/PowerPC/nofpexcept.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/nofpexcept.ll
@@ -0,0 +1,23 @@
+; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu < %s \
+; RUN:   -stop-after=finalize-isel -verify-machineinstrs | FileCheck %s 
+
+; Verify if the mayRaiseFPException is set for FCMPD/FCMPS
+define i32 @fcmpu(double %a, double %b) {
+  ; CHECK-LABEL: name: fcmpu
+  ; CHECK: bb.0.entry:
+  ; CHECK:   liveins: $f1, $f2
+  ; CHECK:   [[COPY:%[0-9]+]]:f8rc = COPY $f2
+  ; CHECK:   [[COPY1:%[0-9]+]]:f8rc = COPY $f1
+  ; CHECK:   %2:crrc = nofpexcept FCMPUD [[COPY1]], [[COPY]]
+  ; CHECK:   [[COPY2:%[0-9]+]]:crbitrc = COPY %2.sub_gt
+  ; CHECK:   [[LI8_:%[0-9]+]]:g8rc_and_g8rc_nox0 = LI8 0
+  ; CHECK:   [[LI8_1:%[0-9]+]]:g8rc_and_g8rc_nox0 = LI8 1
+  ; CHECK:   [[ISEL8_:%[0-9]+]]:g8rc = ISEL8 [[LI8_1]], [[LI8_]], [[COPY2]]
+  ; CHECK:   $x3 = COPY [[ISEL8_]]
+  ; CHECK:   BLR8 implicit $lr8, implicit $rm, implicit $x3
+entry:
+  %r = fcmp ogt double %a, %b
+  %g = zext i1 %r to i32
+  ret i32 %g
+}
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td
===================================================================
--- llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -2624,7 +2624,7 @@
 }
 }
 let PPC970_Unit = 3, Predicates = [HasFPU] in {  // FPU Operations.
-let isCompare = 1, hasSideEffects = 0 in {
+let isCompare = 1, mayRaiseFPException = 1, hasSideEffects = 0 in {
   def FCMPUS : XForm_17<63, 0, (outs crrc:$crD), (ins f4rc:$fA, f4rc:$fB),
                         "fcmpu $crD, $fA, $fB", IIC_FPCompare>;
   def FCMPOS : XForm_17<63, 32, (outs crrc:$crD), (ins f4rc:$fA, f4rc:$fB),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83937.290389.patch
Type: text/x-patch
Size: 1821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200908/28a7795d/attachment.bin>


More information about the llvm-commits mailing list