[PATCH] D29958: AMDGPU : Replace FMAD with FMA when denormals are enabled.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 16:42:54 PST 2017


arsenm added inline comments.


================
Comment at: lib/Target/AMDGPU/AMDGPUISelLowering.cpp:1297
+  unsigned OpCode = Subtarget->hasFP32Denormals() ? 
+                    (unsigned)AMDGPUISD::FMAD_FTZ : 
+                    (unsigned)ISD::FMAD;
----------------
The casts are unnecessary


================
Comment at: lib/Target/AMDGPU/SIInstructions.td:505
+  def : Pat <
+    (vt (AMDGPUfmad_ftz vt:$src0, vt:$src1, vt:$src2)),
+    (inst 0, $src0, 0, $src1, 0, $src2, 0, 0) 
----------------
This won't fold the neg source modifier, so will still make code worse. There should be a 3-operand class with source modifiers you should use rather than calling it FMAC. This also can be a class, a multi class isn't necessary


================
Comment at: test/CodeGen/AMDGPU/udiv.ll:166
+; GCN-LABEL: {{^}}fdiv_test_denormals
+; VI: v_mad_f32
+define amdgpu_kernel void @fdiv_test_denormals(i8 addrspace(1)* nocapture readonly %arg) {
----------------
Should check the neg source modifier is used


Repository:
  rL LLVM

https://reviews.llvm.org/D29958





More information about the llvm-commits mailing list