[llvm] r294587 - [X86][SSE] Added extra FMA/NO-FMA reciprocal test cases for D26855
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 06:14:07 PST 2017
Author: rksimon
Date: Thu Feb 9 08:14:06 2017
New Revision: 294587
URL: http://llvm.org/viewvc/llvm-project?rev=294587&view=rev
Log:
[X86][SSE] Added extra FMA/NO-FMA reciprocal test cases for D26855
Test for expected codegen for nr reciprocal cases with/without FMA
Modified:
llvm/trunk/test/CodeGen/X86/recip-fastmath.ll
llvm/trunk/test/CodeGen/X86/recip-fastmath2.ll
Modified: llvm/trunk/test/CodeGen/X86/recip-fastmath.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/recip-fastmath.ll?rev=294587&r1=294586&r2=294587&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/recip-fastmath.ll (original)
+++ llvm/trunk/test/CodeGen/X86/recip-fastmath.ll Thu Feb 9 08:14:06 2017
@@ -1,11 +1,13 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE --check-prefix=SSE-RECIP
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX-RECIP
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=btver2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=BTVER2
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE --check-prefix=SSE-RECIP
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX-RECIP
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=FMA-RECIP
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=btver2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=BTVER2
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=sandybridge| FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=SANDY
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=haswell | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=HASWELL
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=knl | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX512 --check-prefix=KNL
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX512 --check-prefix=SKX
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=haswell | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=HASWELL
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=haswell -mattr=-fma | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=HASWELL-NO-FMA
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=knl | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX512 --check-prefix=KNL
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX512 --check-prefix=SKX
; If the target's divss/divps instructions are substantially
; slower than rcpss/rcpps with a Newton-Raphson refinement,
@@ -54,6 +56,13 @@ define float @f32_one_step(float %x) #1
; AVX-RECIP-NEXT: vaddss %xmm0, %xmm1, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: f32_one_step:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpss %xmm0, %xmm0, %xmm1
+; FMA-RECIP-NEXT: vfnmadd213ss {{.*}}(%rip), %xmm1, %xmm0
+; FMA-RECIP-NEXT: vfmadd132ss %xmm1, %xmm1, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: f32_one_step:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
@@ -81,6 +90,16 @@ define float @f32_one_step(float %x) #1
; HASWELL-NEXT: vfmadd132ss %xmm1, %xmm1, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: f32_one_step:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpss %xmm0, %xmm0, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulss %xmm1, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; HASWELL-NO-FMA-NEXT: vsubss %xmm0, %xmm2, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulss %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vaddss %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; AVX512-LABEL: f32_one_step:
; AVX512: # BB#0:
; AVX512-NEXT: vrcp14ss %xmm0, %xmm0, %xmm1
@@ -123,6 +142,17 @@ define float @f32_two_step(float %x) #2
; AVX-RECIP-NEXT: vaddss %xmm0, %xmm1, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: f32_two_step:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpss %xmm0, %xmm0, %xmm1
+; FMA-RECIP-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; FMA-RECIP-NEXT: vmovaps %xmm1, %xmm3
+; FMA-RECIP-NEXT: vfnmadd213ss %xmm2, %xmm0, %xmm3
+; FMA-RECIP-NEXT: vfmadd132ss %xmm1, %xmm1, %xmm3
+; FMA-RECIP-NEXT: vfnmadd213ss %xmm2, %xmm3, %xmm0
+; FMA-RECIP-NEXT: vfmadd132ss %xmm3, %xmm3, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: f32_two_step:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero
@@ -162,6 +192,20 @@ define float @f32_two_step(float %x) #2
; HASWELL-NEXT: vfmadd132ss %xmm3, %xmm3, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: f32_two_step:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpss %xmm0, %xmm0, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulss %xmm1, %xmm0, %xmm2
+; HASWELL-NO-FMA-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero
+; HASWELL-NO-FMA-NEXT: vsubss %xmm2, %xmm3, %xmm2
+; HASWELL-NO-FMA-NEXT: vmulss %xmm2, %xmm1, %xmm2
+; HASWELL-NO-FMA-NEXT: vaddss %xmm2, %xmm1, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulss %xmm1, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vsubss %xmm0, %xmm3, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulss %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vaddss %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; AVX512-LABEL: f32_two_step:
; AVX512: # BB#0:
; AVX512-NEXT: vrcp14ss %xmm0, %xmm0, %xmm1
@@ -190,6 +234,12 @@ define <4 x float> @v4f32_no_estimate(<4
; AVX-RECIP-NEXT: vdivps %xmm0, %xmm1, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v4f32_no_estimate:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vmovaps {{.*#+}} xmm1 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
+; FMA-RECIP-NEXT: vdivps %xmm0, %xmm1, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v4f32_no_estimate:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} xmm1 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -208,6 +258,12 @@ define <4 x float> @v4f32_no_estimate(<4
; HASWELL-NEXT: vdivps %xmm0, %xmm1, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v4f32_no_estimate:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %xmm1
+; HASWELL-NO-FMA-NEXT: vdivps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; AVX512-LABEL: v4f32_no_estimate:
; AVX512: # BB#0:
; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %xmm1
@@ -239,6 +295,13 @@ define <4 x float> @v4f32_one_step(<4 x
; AVX-RECIP-NEXT: vaddps %xmm0, %xmm1, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v4f32_one_step:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %xmm0, %xmm1
+; FMA-RECIP-NEXT: vfnmadd213ps {{.*}}(%rip), %xmm1, %xmm0
+; FMA-RECIP-NEXT: vfmadd132ps %xmm1, %xmm1, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v4f32_one_step:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -267,6 +330,16 @@ define <4 x float> @v4f32_one_step(<4 x
; HASWELL-NEXT: vfmadd132ps %xmm1, %xmm1, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v4f32_one_step:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %xmm0, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %xmm2
+; HASWELL-NO-FMA-NEXT: vsubps %xmm0, %xmm2, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vaddps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v4f32_one_step:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %xmm0, %xmm1
@@ -317,6 +390,17 @@ define <4 x float> @v4f32_two_step(<4 x
; AVX-RECIP-NEXT: vaddps %xmm0, %xmm1, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v4f32_two_step:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %xmm0, %xmm1
+; FMA-RECIP-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
+; FMA-RECIP-NEXT: vmovaps %xmm1, %xmm3
+; FMA-RECIP-NEXT: vfnmadd213ps %xmm2, %xmm0, %xmm3
+; FMA-RECIP-NEXT: vfmadd132ps %xmm1, %xmm1, %xmm3
+; FMA-RECIP-NEXT: vfnmadd213ps %xmm2, %xmm3, %xmm0
+; FMA-RECIP-NEXT: vfmadd132ps %xmm3, %xmm3, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v4f32_two_step:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -356,6 +440,20 @@ define <4 x float> @v4f32_two_step(<4 x
; HASWELL-NEXT: vfmadd132ps %xmm3, %xmm3, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v4f32_two_step:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %xmm0, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulps %xmm1, %xmm0, %xmm2
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %xmm3
+; HASWELL-NO-FMA-NEXT: vsubps %xmm2, %xmm3, %xmm2
+; HASWELL-NO-FMA-NEXT: vmulps %xmm2, %xmm1, %xmm2
+; HASWELL-NO-FMA-NEXT: vaddps %xmm2, %xmm1, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vsubps %xmm0, %xmm3, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vaddps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v4f32_two_step:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %xmm0, %xmm1
@@ -398,6 +496,12 @@ define <8 x float> @v8f32_no_estimate(<8
; AVX-RECIP-NEXT: vdivps %ymm0, %ymm1, %ymm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v8f32_no_estimate:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vmovaps {{.*#+}} ymm1 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
+; FMA-RECIP-NEXT: vdivps %ymm0, %ymm1, %ymm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v8f32_no_estimate:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} ymm1 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -416,6 +520,12 @@ define <8 x float> @v8f32_no_estimate(<8
; HASWELL-NEXT: vdivps %ymm0, %ymm1, %ymm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v8f32_no_estimate:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %ymm1
+; HASWELL-NO-FMA-NEXT: vdivps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; AVX512-LABEL: v8f32_no_estimate:
; AVX512: # BB#0:
; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %ymm1
@@ -454,6 +564,13 @@ define <8 x float> @v8f32_one_step(<8 x
; AVX-RECIP-NEXT: vaddps %ymm0, %ymm1, %ymm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v8f32_one_step:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %ymm0, %ymm1
+; FMA-RECIP-NEXT: vfnmadd213ps {{.*}}(%rip), %ymm1, %ymm0
+; FMA-RECIP-NEXT: vfmadd132ps %ymm1, %ymm1, %ymm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v8f32_one_step:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} ymm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -482,6 +599,16 @@ define <8 x float> @v8f32_one_step(<8 x
; HASWELL-NEXT: vfmadd132ps %ymm1, %ymm1, %ymm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v8f32_one_step:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %ymm0, %ymm1
+; HASWELL-NO-FMA-NEXT: vmulps %ymm1, %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %ymm2
+; HASWELL-NO-FMA-NEXT: vsubps %ymm0, %ymm2, %ymm0
+; HASWELL-NO-FMA-NEXT: vmulps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: vaddps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v8f32_one_step:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %ymm0, %ymm1
@@ -545,6 +672,17 @@ define <8 x float> @v8f32_two_step(<8 x
; AVX-RECIP-NEXT: vaddps %ymm0, %ymm1, %ymm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v8f32_two_step:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %ymm0, %ymm1
+; FMA-RECIP-NEXT: vmovaps {{.*#+}} ymm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
+; FMA-RECIP-NEXT: vmovaps %ymm1, %ymm3
+; FMA-RECIP-NEXT: vfnmadd213ps %ymm2, %ymm0, %ymm3
+; FMA-RECIP-NEXT: vfmadd132ps %ymm1, %ymm1, %ymm3
+; FMA-RECIP-NEXT: vfnmadd213ps %ymm2, %ymm3, %ymm0
+; FMA-RECIP-NEXT: vfmadd132ps %ymm3, %ymm3, %ymm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v8f32_two_step:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} ymm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -584,6 +722,20 @@ define <8 x float> @v8f32_two_step(<8 x
; HASWELL-NEXT: vfmadd132ps %ymm3, %ymm3, %ymm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v8f32_two_step:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %ymm0, %ymm1
+; HASWELL-NO-FMA-NEXT: vmulps %ymm1, %ymm0, %ymm2
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %ymm3
+; HASWELL-NO-FMA-NEXT: vsubps %ymm2, %ymm3, %ymm2
+; HASWELL-NO-FMA-NEXT: vmulps %ymm2, %ymm1, %ymm2
+; HASWELL-NO-FMA-NEXT: vaddps %ymm2, %ymm1, %ymm1
+; HASWELL-NO-FMA-NEXT: vmulps %ymm1, %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: vsubps %ymm0, %ymm3, %ymm0
+; HASWELL-NO-FMA-NEXT: vmulps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: vaddps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v8f32_two_step:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %ymm0, %ymm1
Modified: llvm/trunk/test/CodeGen/X86/recip-fastmath2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/recip-fastmath2.ll?rev=294587&r1=294586&r2=294587&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/recip-fastmath2.ll (original)
+++ llvm/trunk/test/CodeGen/X86/recip-fastmath2.ll Thu Feb 9 08:14:06 2017
@@ -1,11 +1,13 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE --check-prefix=SSE-RECIP
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX-RECIP
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=btver2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=BTVER2
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE --check-prefix=SSE-RECIP
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX-RECIP
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=FMA-RECIP
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=btver2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=BTVER2
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=sandybridge| FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=SANDY
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=haswell | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=HASWELL
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=knl | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX512 --check-prefix=KNL
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX512 --check-prefix=SKX
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=haswell | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=HASWELL
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=haswell -mattr=-fma | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=HASWELL-NO-FMA
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=knl | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX512 --check-prefix=KNL
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX512 --check-prefix=SKX
; It's the extra tests coverage for recip as discussed on D26855.
@@ -22,6 +24,12 @@ define float @f32_no_step_2(float %x) #3
; AVX-RECIP-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: f32_no_step_2:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpss %xmm0, %xmm0, %xmm0
+; FMA-RECIP-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: f32_no_step_2:
; BTVER2: # BB#0:
; BTVER2-NEXT: vrcpss %xmm0, %xmm0, %xmm0
@@ -40,6 +48,12 @@ define float @f32_no_step_2(float %x) #3
; HASWELL-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: f32_no_step_2:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpss %xmm0, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; AVX512-LABEL: f32_no_step_2:
; AVX512: # BB#0:
; AVX512-NEXT: vrcp14ss %xmm0, %xmm0, %xmm0
@@ -73,6 +87,14 @@ define float @f32_one_step_2(float %x) #
; AVX-RECIP-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: f32_one_step_2:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpss %xmm0, %xmm0, %xmm1
+; FMA-RECIP-NEXT: vfnmadd213ss {{.*}}(%rip), %xmm1, %xmm0
+; FMA-RECIP-NEXT: vfmadd132ss %xmm1, %xmm1, %xmm0
+; FMA-RECIP-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: f32_one_step_2:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
@@ -103,6 +125,17 @@ define float @f32_one_step_2(float %x) #
; HASWELL-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: f32_one_step_2:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpss %xmm0, %xmm0, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulss %xmm1, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; HASWELL-NO-FMA-NEXT: vsubss %xmm0, %xmm2, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulss %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vaddss %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; AVX512-LABEL: f32_one_step_2:
; AVX512: # BB#0:
; AVX512-NEXT: vrcp14ss %xmm0, %xmm0, %xmm1
@@ -148,6 +181,18 @@ define float @f32_two_step_2(float %x) #
; AVX-RECIP-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: f32_two_step_2:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpss %xmm0, %xmm0, %xmm1
+; FMA-RECIP-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; FMA-RECIP-NEXT: vmovaps %xmm1, %xmm3
+; FMA-RECIP-NEXT: vfnmadd213ss %xmm2, %xmm0, %xmm3
+; FMA-RECIP-NEXT: vfmadd132ss %xmm1, %xmm1, %xmm3
+; FMA-RECIP-NEXT: vfnmadd213ss %xmm2, %xmm3, %xmm0
+; FMA-RECIP-NEXT: vfmadd132ss %xmm3, %xmm3, %xmm0
+; FMA-RECIP-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: f32_two_step_2:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero
@@ -190,6 +235,21 @@ define float @f32_two_step_2(float %x) #
; HASWELL-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: f32_two_step_2:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpss %xmm0, %xmm0, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulss %xmm1, %xmm0, %xmm2
+; HASWELL-NO-FMA-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero
+; HASWELL-NO-FMA-NEXT: vsubss %xmm2, %xmm3, %xmm2
+; HASWELL-NO-FMA-NEXT: vmulss %xmm2, %xmm1, %xmm2
+; HASWELL-NO-FMA-NEXT: vaddss %xmm2, %xmm1, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulss %xmm1, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vsubss %xmm0, %xmm3, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulss %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vaddss %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; AVX512-LABEL: f32_two_step_2:
; AVX512: # BB#0:
; AVX512-NEXT: vrcp14ss %xmm0, %xmm0, %xmm1
@@ -229,6 +289,14 @@ define <4 x float> @v4f32_one_step2(<4 x
; AVX-RECIP-NEXT: vmulps {{.*}}(%rip), %xmm0, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v4f32_one_step2:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %xmm0, %xmm1
+; FMA-RECIP-NEXT: vfnmadd213ps {{.*}}(%rip), %xmm1, %xmm0
+; FMA-RECIP-NEXT: vfmadd132ps %xmm1, %xmm1, %xmm0
+; FMA-RECIP-NEXT: vmulps {{.*}}(%rip), %xmm0, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v4f32_one_step2:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -260,6 +328,17 @@ define <4 x float> @v4f32_one_step2(<4 x
; HASWELL-NEXT: vmulps {{.*}}(%rip), %xmm0, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v4f32_one_step2:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %xmm0, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %xmm2
+; HASWELL-NO-FMA-NEXT: vsubps %xmm0, %xmm2, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vaddps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulps {{.*}}(%rip), %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v4f32_one_step2:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %xmm0, %xmm1
@@ -314,6 +393,18 @@ define <4 x float> @v4f32_two_step2(<4 x
; AVX-RECIP-NEXT: vmulps {{.*}}(%rip), %xmm0, %xmm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v4f32_two_step2:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %xmm0, %xmm1
+; FMA-RECIP-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
+; FMA-RECIP-NEXT: vmovaps %xmm1, %xmm3
+; FMA-RECIP-NEXT: vfnmadd213ps %xmm2, %xmm0, %xmm3
+; FMA-RECIP-NEXT: vfmadd132ps %xmm1, %xmm1, %xmm3
+; FMA-RECIP-NEXT: vfnmadd213ps %xmm2, %xmm3, %xmm0
+; FMA-RECIP-NEXT: vfmadd132ps %xmm3, %xmm3, %xmm0
+; FMA-RECIP-NEXT: vmulps {{.*}}(%rip), %xmm0, %xmm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v4f32_two_step2:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -356,6 +447,21 @@ define <4 x float> @v4f32_two_step2(<4 x
; HASWELL-NEXT: vmulps {{.*}}(%rip), %xmm0, %xmm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v4f32_two_step2:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %xmm0, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulps %xmm1, %xmm0, %xmm2
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %xmm3
+; HASWELL-NO-FMA-NEXT: vsubps %xmm2, %xmm3, %xmm2
+; HASWELL-NO-FMA-NEXT: vmulps %xmm2, %xmm1, %xmm2
+; HASWELL-NO-FMA-NEXT: vaddps %xmm2, %xmm1, %xmm1
+; HASWELL-NO-FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: vsubps %xmm0, %xmm3, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vaddps %xmm0, %xmm1, %xmm0
+; HASWELL-NO-FMA-NEXT: vmulps {{.*}}(%rip), %xmm0, %xmm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v4f32_two_step2:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %xmm0, %xmm1
@@ -415,6 +521,14 @@ define <8 x float> @v8f32_one_step2(<8 x
; AVX-RECIP-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v8f32_one_step2:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %ymm0, %ymm1
+; FMA-RECIP-NEXT: vfnmadd213ps {{.*}}(%rip), %ymm1, %ymm0
+; FMA-RECIP-NEXT: vfmadd132ps %ymm1, %ymm1, %ymm0
+; FMA-RECIP-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v8f32_one_step2:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} ymm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -446,6 +560,17 @@ define <8 x float> @v8f32_one_step2(<8 x
; HASWELL-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v8f32_one_step2:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %ymm0, %ymm1
+; HASWELL-NO-FMA-NEXT: vmulps %ymm1, %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %ymm2
+; HASWELL-NO-FMA-NEXT: vsubps %ymm0, %ymm2, %ymm0
+; HASWELL-NO-FMA-NEXT: vmulps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: vaddps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v8f32_one_step2:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %ymm0, %ymm1
@@ -514,6 +639,18 @@ define <8 x float> @v8f32_two_step2(<8 x
; AVX-RECIP-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v8f32_two_step2:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %ymm0, %ymm1
+; FMA-RECIP-NEXT: vmovaps {{.*#+}} ymm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
+; FMA-RECIP-NEXT: vmovaps %ymm1, %ymm3
+; FMA-RECIP-NEXT: vfnmadd213ps %ymm2, %ymm0, %ymm3
+; FMA-RECIP-NEXT: vfmadd132ps %ymm1, %ymm1, %ymm3
+; FMA-RECIP-NEXT: vfnmadd213ps %ymm2, %ymm3, %ymm0
+; FMA-RECIP-NEXT: vfmadd132ps %ymm3, %ymm3, %ymm0
+; FMA-RECIP-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v8f32_two_step2:
; BTVER2: # BB#0:
; BTVER2-NEXT: vmovaps {{.*#+}} ymm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
@@ -556,6 +693,21 @@ define <8 x float> @v8f32_two_step2(<8 x
; HASWELL-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v8f32_two_step2:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %ymm0, %ymm1
+; HASWELL-NO-FMA-NEXT: vmulps %ymm1, %ymm0, %ymm2
+; HASWELL-NO-FMA-NEXT: vbroadcastss {{.*}}(%rip), %ymm3
+; HASWELL-NO-FMA-NEXT: vsubps %ymm2, %ymm3, %ymm2
+; HASWELL-NO-FMA-NEXT: vmulps %ymm2, %ymm1, %ymm2
+; HASWELL-NO-FMA-NEXT: vaddps %ymm2, %ymm1, %ymm1
+; HASWELL-NO-FMA-NEXT: vmulps %ymm1, %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: vsubps %ymm0, %ymm3, %ymm0
+; HASWELL-NO-FMA-NEXT: vmulps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: vaddps %ymm0, %ymm1, %ymm0
+; HASWELL-NO-FMA-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v8f32_two_step2:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %ymm0, %ymm1
@@ -595,6 +747,11 @@ define <8 x float> @v8f32_no_step(<8 x f
; AVX-RECIP-NEXT: vrcpps %ymm0, %ymm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v8f32_no_step:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %ymm0, %ymm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v8f32_no_step:
; BTVER2: # BB#0:
; BTVER2-NEXT: vrcpps %ymm0, %ymm0
@@ -610,6 +767,11 @@ define <8 x float> @v8f32_no_step(<8 x f
; HASWELL-NEXT: vrcpps %ymm0, %ymm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v8f32_no_step:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v8f32_no_step:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %ymm0, %ymm0
@@ -638,6 +800,12 @@ define <8 x float> @v8f32_no_step2(<8 x
; AVX-RECIP-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
; AVX-RECIP-NEXT: retq
;
+; FMA-RECIP-LABEL: v8f32_no_step2:
+; FMA-RECIP: # BB#0:
+; FMA-RECIP-NEXT: vrcpps %ymm0, %ymm0
+; FMA-RECIP-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
+; FMA-RECIP-NEXT: retq
+;
; BTVER2-LABEL: v8f32_no_step2:
; BTVER2: # BB#0:
; BTVER2-NEXT: vrcpps %ymm0, %ymm0
@@ -656,6 +824,12 @@ define <8 x float> @v8f32_no_step2(<8 x
; HASWELL-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
; HASWELL-NEXT: retq
;
+; HASWELL-NO-FMA-LABEL: v8f32_no_step2:
+; HASWELL-NO-FMA: # BB#0:
+; HASWELL-NO-FMA-NEXT: vrcpps %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: vmulps {{.*}}(%rip), %ymm0, %ymm0
+; HASWELL-NO-FMA-NEXT: retq
+;
; KNL-LABEL: v8f32_no_step2:
; KNL: # BB#0:
; KNL-NEXT: vrcpps %ymm0, %ymm0
More information about the llvm-commits
mailing list