[llvm] 35e5c33 - [X86] Pre-commit test for D90901
Jim Lin via llvm-commits
llvm-commits at lists.llvm.org
Fri May 21 07:59:42 PDT 2021
Author: Jim Lin
Date: 2021-05-21T23:02:19+08:00
New Revision: 35e5c3310fb0d974b6a151c775ac46a3c3a0e151
URL: https://github.com/llvm/llvm-project/commit/35e5c3310fb0d974b6a151c775ac46a3c3a0e151
DIFF: https://github.com/llvm/llvm-project/commit/35e5c3310fb0d974b6a151c775ac46a3c3a0e151.diff
LOG: [X86] Pre-commit test for D90901
Differential Revision: https://reviews.llvm.org/D102621
Added:
llvm/test/CodeGen/X86/fma-signed-zero.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/fma-signed-zero.ll b/llvm/test/CodeGen/X86/fma-signed-zero.ll
new file mode 100644
index 0000000000000..c9cfe6eb0525d
--- /dev/null
+++ b/llvm/test/CodeGen/X86/fma-signed-zero.ll
@@ -0,0 +1,57 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+fma | FileCheck %s
+
+; This test checks that (fneg (fma (fneg x), y, (fneg z))) can't be folded to (fma x, y, z)
+; without no signed zeros flag (nsz).
+
+declare float @llvm.fma.f32(float, float, float)
+
+define float @fneg_fma32(float %x, float %y, float %z) {
+; CHECK-LABEL: fneg_fma32:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
+; CHECK-NEXT: retq
+ %negx = fneg float %x
+ %negz = fneg float %z
+ %fma = call float @llvm.fma.f32(float %negx, float %y, float %negz)
+ %n = fneg float %fma
+ ret float %n
+}
+
+define float @fneg_fma32_nsz(float %x, float %y, float %z) {
+; CHECK-LABEL: fneg_fma32_nsz:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
+; CHECK-NEXT: retq
+ %negx = fneg float %x
+ %negz = fneg float %z
+ %fma = call nsz float @llvm.fma.f32(float %negx, float %y, float %negz)
+ %n = fneg float %fma
+ ret float %n
+}
+
+declare double @llvm.fma.f64(double, double, double)
+
+define double @fneg_fma64(double %x, double %y, double %z) {
+; CHECK-LABEL: fneg_fma64:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vfmadd213sd {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
+; CHECK-NEXT: retq
+ %negx = fneg double %x
+ %negz = fneg double %z
+ %fma = call double @llvm.fma.f64(double %negx, double %y, double %negz)
+ %n = fneg double %fma
+ ret double %n
+}
+
+define double @fneg_fma64_nsz(double %x, double %y, double %z) {
+; CHECK-LABEL: fneg_fma64_nsz:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vfmadd213sd {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
+; CHECK-NEXT: retq
+ %negx = fneg double %x
+ %negz = fneg double %z
+ %fma = call nsz double @llvm.fma.f64(double %negx, double %y, double %negz)
+ %n = fneg double %fma
+ ret double %n
+}
More information about the llvm-commits
mailing list