Index: test/CodeGen/X86/fma_patterns.ll =================================================================== --- test/CodeGen/X86/fma_patterns.ll +++ test/CodeGen/X86/fma_patterns.ll @@ -1,9 +1,13 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; NOTE: Assertions have been autogenerated by update_llc_test_checks.py -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA4 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4 -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA4 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq,+avx512vl -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA --check-prefix=FMA-INFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA4 --check-prefix=FMA4-INFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4 -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA4 --check-prefix=FMA4-INFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq,+avx512vl -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 --check-prefix=AVX512-INFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma -fp-contract=fast -enable-no-infs-fp-math | FileCheck %s --check-prefix=ALL --check-prefix=FMA --check-prefix=FMA-NOINFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast -enable-no-infs-fp-math | FileCheck %s --check-prefix=ALL --check-prefix=FMA4 --check-prefix=FMA4-NOINFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4 -fp-contract=fast -enable-no-infs-fp-math | FileCheck %s --check-prefix=ALL --check-prefix=FMA4 --check-prefix=FMA4-NOINFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq,+avx512vl -fp-contract=fast -enable-no-infs-fp-math | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 --check-prefix=AVX512-NOINFS ; ; Pattern: (fadd (fmul x, y), z) -> (fmadd x,y,z) @@ -558,288 +562,468 @@ ; define <4 x float> @test_v4f32_mul_add_x_one_y(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_add_x_one_y: -; FMA: # BB#0: -; FMA-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 -; FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_add_x_one_y: -; FMA4: # BB#0: -; FMA4-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 -; FMA4-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_add_x_one_y: -; AVX512: # BB#0: -; AVX512-NEXT: vaddps {{.*}}(%rip){1to4}, %xmm0, %xmm0 -; AVX512-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_add_x_one_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_add_x_one_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_add_x_one_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vaddps {{.*}}(%rip){1to4}, %xmm0, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_add_x_one_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_add_x_one_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmaddps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_add_x_one_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %a = fadd <4 x float> %x, %m = fmul <4 x float> %a, %y ret <4 x float> %m } define <4 x float> @test_v4f32_mul_y_add_x_one(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_y_add_x_one: -; FMA: # BB#0: -; FMA-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 -; FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_y_add_x_one: -; FMA4: # BB#0: -; FMA4-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 -; FMA4-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_y_add_x_one: -; AVX512: # BB#0: -; AVX512-NEXT: vaddps {{.*}}(%rip){1to4}, %xmm0, %xmm0 -; AVX512-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_y_add_x_one: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_y_add_x_one: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_y_add_x_one: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vaddps {{.*}}(%rip){1to4}, %xmm0, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_y_add_x_one: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_y_add_x_one: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmaddps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_y_add_x_one: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %a = fadd <4 x float> %x, %m = fmul <4 x float> %y, %a ret <4 x float> %m } define <4 x float> @test_v4f32_mul_add_x_negone_y(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_add_x_negone_y: -; FMA: # BB#0: -; FMA-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 -; FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_add_x_negone_y: -; FMA4: # BB#0: -; FMA4-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 -; FMA4-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_add_x_negone_y: -; AVX512: # BB#0: -; AVX512-NEXT: vaddps {{.*}}(%rip){1to4}, %xmm0, %xmm0 -; AVX512-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_add_x_negone_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_add_x_negone_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_add_x_negone_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vaddps {{.*}}(%rip){1to4}, %xmm0, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_add_x_negone_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmsub213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_add_x_negone_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmsubps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_add_x_negone_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmsub213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %a = fadd <4 x float> %x, %m = fmul <4 x float> %a, %y ret <4 x float> %m } define <4 x float> @test_v4f32_mul_y_add_x_negone(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_y_add_x_negone: -; FMA: # BB#0: -; FMA-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 -; FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_y_add_x_negone: -; FMA4: # BB#0: -; FMA4-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 -; FMA4-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_y_add_x_negone: -; AVX512: # BB#0: -; AVX512-NEXT: vaddps {{.*}}(%rip){1to4}, %xmm0, %xmm0 -; AVX512-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_y_add_x_negone: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_y_add_x_negone: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_y_add_x_negone: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vaddps {{.*}}(%rip){1to4}, %xmm0, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_y_add_x_negone: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmsub213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_y_add_x_negone: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmsubps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_y_add_x_negone: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmsub213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %a = fadd <4 x float> %x, %m = fmul <4 x float> %y, %a ret <4 x float> %m } define <4 x float> @test_v4f32_mul_sub_one_x_y(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_sub_one_x_y: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_sub_one_x_y: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; FMA4-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_sub_one_x_y: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %xmm2 -; AVX512-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; AVX512-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_sub_one_x_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_sub_one_x_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_sub_one_x_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %xmm2 +; AVX512-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_sub_one_x_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_sub_one_x_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_sub_one_x_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <4 x float> , %x %m = fmul <4 x float> %s, %y ret <4 x float> %m } define <4 x float> @test_v4f32_mul_y_sub_one_x(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_y_sub_one_x: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_y_sub_one_x: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; FMA4-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_y_sub_one_x: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %xmm2 -; AVX512-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; AVX512-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_y_sub_one_x: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_y_sub_one_x: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} xmm2 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_y_sub_one_x: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %xmm2 +; AVX512-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_y_sub_one_x: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_y_sub_one_x: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_y_sub_one_x: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <4 x float> , %x %m = fmul <4 x float> %y, %s ret <4 x float> %m } define <4 x float> @test_v4f32_mul_sub_negone_x_y(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_sub_negone_x_y: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} xmm2 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_sub_negone_x_y: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} xmm2 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA4-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; FMA4-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_sub_negone_x_y: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %xmm2 -; AVX512-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; AVX512-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_sub_negone_x_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} xmm2 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_sub_negone_x_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} xmm2 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA4-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_sub_negone_x_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %xmm2 +; AVX512-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_sub_negone_x_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmsub213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_sub_negone_x_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmsubps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_sub_negone_x_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmsub213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <4 x float> , %x %m = fmul <4 x float> %s, %y ret <4 x float> %m } define <4 x float> @test_v4f32_mul_y_sub_negone_x(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_y_sub_negone_x: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} xmm2 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_y_sub_negone_x: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} xmm2 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA4-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; FMA4-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_y_sub_negone_x: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %xmm2 -; AVX512-NEXT: vsubps %xmm0, %xmm2, %xmm0 -; AVX512-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_y_sub_negone_x: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} xmm2 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_y_sub_negone_x: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} xmm2 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA4-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_y_sub_negone_x: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %xmm2 +; AVX512-INFS-NEXT: vsubps %xmm0, %xmm2, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_y_sub_negone_x: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmsub213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_y_sub_negone_x: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmsubps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_y_sub_negone_x: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmsub213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <4 x float> , %x %m = fmul <4 x float> %y, %s ret <4 x float> %m } define <4 x float> @test_v4f32_mul_sub_x_one_y(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_sub_x_one_y: -; FMA: # BB#0: -; FMA-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 -; FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_sub_x_one_y: -; FMA4: # BB#0: -; FMA4-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 -; FMA4-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_sub_x_one_y: -; AVX512: # BB#0: -; AVX512-NEXT: vsubps {{.*}}(%rip){1to4}, %xmm0, %xmm0 -; AVX512-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_sub_x_one_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_sub_x_one_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_sub_x_one_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vsubps {{.*}}(%rip){1to4}, %xmm0, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_sub_x_one_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmsub213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_sub_x_one_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmsubps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_sub_x_one_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmsub213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <4 x float> %x, %m = fmul <4 x float> %s, %y ret <4 x float> %m } define <4 x float> @test_v4f32_mul_y_sub_x_one(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_y_sub_x_one: -; FMA: # BB#0: -; FMA-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 -; FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_y_sub_x_one: -; FMA4: # BB#0: -; FMA4-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 -; FMA4-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_y_sub_x_one: -; AVX512: # BB#0: -; AVX512-NEXT: vsubps {{.*}}(%rip){1to4}, %xmm0, %xmm0 -; AVX512-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_y_sub_x_one: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_y_sub_x_one: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_y_sub_x_one: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vsubps {{.*}}(%rip){1to4}, %xmm0, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_y_sub_x_one: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmsub213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_y_sub_x_one: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmsubps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_y_sub_x_one: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmsub213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <4 x float> %x, %m = fmul <4 x float> %y, %s ret <4 x float> %m } define <4 x float> @test_v4f32_mul_sub_x_negone_y(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_sub_x_negone_y: -; FMA: # BB#0: -; FMA-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 -; FMA-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_sub_x_negone_y: -; FMA4: # BB#0: -; FMA4-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 -; FMA4-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_sub_x_negone_y: -; AVX512: # BB#0: -; AVX512-NEXT: vsubps {{.*}}(%rip){1to4}, %xmm0, %xmm0 -; AVX512-NEXT: vmulps %xmm1, %xmm0, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_sub_x_negone_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_sub_x_negone_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_sub_x_negone_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vsubps {{.*}}(%rip){1to4}, %xmm0, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm1, %xmm0, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_sub_x_negone_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_sub_x_negone_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmaddps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_sub_x_negone_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <4 x float> %x, %m = fmul <4 x float> %s, %y ret <4 x float> %m } define <4 x float> @test_v4f32_mul_y_sub_x_negone(<4 x float> %x, <4 x float> %y) { -; FMA-LABEL: test_v4f32_mul_y_sub_x_negone: -; FMA: # BB#0: -; FMA-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 -; FMA-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_mul_y_sub_x_negone: -; FMA4: # BB#0: -; FMA4-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 -; FMA4-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_mul_y_sub_x_negone: -; AVX512: # BB#0: -; AVX512-NEXT: vsubps {{.*}}(%rip){1to4}, %xmm0, %xmm0 -; AVX512-NEXT: vmulps %xmm0, %xmm1, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_mul_y_sub_x_negone: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 +; FMA-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_mul_y_sub_x_negone: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vsubps {{.*}}(%rip), %xmm0, %xmm0 +; FMA4-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_mul_y_sub_x_negone: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vsubps {{.*}}(%rip){1to4}, %xmm0, %xmm0 +; AVX512-INFS-NEXT: vmulps %xmm0, %xmm1, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_mul_y_sub_x_negone: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm1, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_mul_y_sub_x_negone: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmaddps %xmm1, %xmm1, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_mul_y_sub_x_negone: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm1, %xmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <4 x float> %x, %m = fmul <4 x float> %y, %s ret <4 x float> %m @@ -850,29 +1034,47 @@ ; define float @test_f32_interp(float %x, float %y, float %t) { -; FMA-LABEL: test_f32_interp: -; FMA: # BB#0: -; FMA-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero -; FMA-NEXT: vsubss %xmm2, %xmm3, %xmm3 -; FMA-NEXT: vmulss %xmm3, %xmm1, %xmm1 -; FMA-NEXT: vfmadd213ss %xmm1, %xmm2, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_f32_interp: -; FMA4: # BB#0: -; FMA4-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero -; FMA4-NEXT: vsubss %xmm2, %xmm3, %xmm3 -; FMA4-NEXT: vmulss %xmm3, %xmm1, %xmm1 -; FMA4-NEXT: vfmaddss %xmm1, %xmm2, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_f32_interp: -; AVX512: # BB#0: -; AVX512-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero -; AVX512-NEXT: vsubss %xmm2, %xmm3, %xmm3 -; AVX512-NEXT: vmulss %xmm3, %xmm1, %xmm1 -; AVX512-NEXT: vfmadd213ss %xmm1, %xmm2, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_f32_interp: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero +; FMA-INFS-NEXT: vsubss %xmm2, %xmm3, %xmm3 +; FMA-INFS-NEXT: vmulss %xmm3, %xmm1, %xmm1 +; FMA-INFS-NEXT: vfmadd213ss %xmm1, %xmm2, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_f32_interp: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero +; FMA4-INFS-NEXT: vsubss %xmm2, %xmm3, %xmm3 +; FMA4-INFS-NEXT: vmulss %xmm3, %xmm1, %xmm1 +; FMA4-INFS-NEXT: vfmaddss %xmm1, %xmm2, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_f32_interp: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero +; AVX512-INFS-NEXT: vsubss %xmm2, %xmm3, %xmm3 +; AVX512-INFS-NEXT: vmulss %xmm3, %xmm1, %xmm1 +; AVX512-INFS-NEXT: vfmadd213ss %xmm1, %xmm2, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_f32_interp: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213ss %xmm1, %xmm2, %xmm1 +; FMA-NOINFS-NEXT: vfmadd213ss %xmm1, %xmm2, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_f32_interp: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddss %xmm1, %xmm1, %xmm2, %xmm1 +; FMA4-NOINFS-NEXT: vfmaddss %xmm1, %xmm2, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_f32_interp: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213ss %xmm1, %xmm2, %xmm1 +; AVX512-NOINFS-NEXT: vfmadd213ss %xmm1, %xmm2, %xmm0 +; AVX512-NOINFS-NEXT: retq %t1 = fsub float 1.0, %t %tx = fmul float %x, %t %ty = fmul float %y, %t1 @@ -881,29 +1083,47 @@ } define <4 x float> @test_v4f32_interp(<4 x float> %x, <4 x float> %y, <4 x float> %t) { -; FMA-LABEL: test_v4f32_interp: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA-NEXT: vsubps %xmm2, %xmm3, %xmm3 -; FMA-NEXT: vmulps %xmm3, %xmm1, %xmm1 -; FMA-NEXT: vfmadd213ps %xmm1, %xmm2, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f32_interp: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubps %xmm2, %xmm3, %xmm3 -; FMA4-NEXT: vmulps %xmm3, %xmm1, %xmm1 -; FMA4-NEXT: vfmaddps %xmm1, %xmm2, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f32_interp: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %xmm3 -; AVX512-NEXT: vsubps %xmm2, %xmm3, %xmm3 -; AVX512-NEXT: vmulps %xmm3, %xmm1, %xmm1 -; AVX512-NEXT: vfmadd213ps %xmm1, %xmm2, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f32_interp: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vsubps %xmm2, %xmm3, %xmm3 +; FMA-INFS-NEXT: vmulps %xmm3, %xmm1, %xmm1 +; FMA-INFS-NEXT: vfmadd213ps %xmm1, %xmm2, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f32_interp: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubps %xmm2, %xmm3, %xmm3 +; FMA4-INFS-NEXT: vmulps %xmm3, %xmm1, %xmm1 +; FMA4-INFS-NEXT: vfmaddps %xmm1, %xmm2, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f32_interp: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %xmm3 +; AVX512-INFS-NEXT: vsubps %xmm2, %xmm3, %xmm3 +; AVX512-INFS-NEXT: vmulps %xmm3, %xmm1, %xmm1 +; AVX512-INFS-NEXT: vfmadd213ps %xmm1, %xmm2, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f32_interp: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213ps %xmm1, %xmm2, %xmm1 +; FMA-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm2, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f32_interp: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddps %xmm1, %xmm1, %xmm2, %xmm1 +; FMA4-NOINFS-NEXT: vfmaddps %xmm1, %xmm2, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f32_interp: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213ps %xmm1, %xmm2, %xmm1 +; AVX512-NOINFS-NEXT: vfmadd213ps %xmm1, %xmm2, %xmm0 +; AVX512-NOINFS-NEXT: retq %t1 = fsub <4 x float> , %t %tx = fmul <4 x float> %x, %t %ty = fmul <4 x float> %y, %t1 @@ -912,29 +1132,47 @@ } define <8 x float> @test_v8f32_interp(<8 x float> %x, <8 x float> %y, <8 x float> %t) { -; FMA-LABEL: test_v8f32_interp: -; FMA: # BB#0: -; FMA-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] -; FMA-NEXT: vsubps %ymm2, %ymm3, %ymm3 -; FMA-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA-NEXT: vfmadd213ps %ymm1, %ymm2, %ymm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v8f32_interp: -; FMA4: # BB#0: -; FMA4-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] -; FMA4-NEXT: vsubps %ymm2, %ymm3, %ymm3 -; FMA4-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA4-NEXT: vfmaddps %ymm1, %ymm2, %ymm0, %ymm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v8f32_interp: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %ymm3 -; AVX512-NEXT: vsubps %ymm2, %ymm3, %ymm3 -; AVX512-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; AVX512-NEXT: vfmadd213ps %ymm1, %ymm2, %ymm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v8f32_interp: +; FMA-INFS: # BB#0: +; FMA-INFS-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] +; FMA-INFS-NEXT: vsubps %ymm2, %ymm3, %ymm3 +; FMA-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA-INFS-NEXT: vfmadd213ps %ymm1, %ymm2, %ymm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v8f32_interp: +; FMA4-INFS: # BB#0: +; FMA4-INFS-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] +; FMA4-INFS-NEXT: vsubps %ymm2, %ymm3, %ymm3 +; FMA4-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vfmaddps %ymm1, %ymm2, %ymm0, %ymm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v8f32_interp: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %ymm3 +; AVX512-INFS-NEXT: vsubps %ymm2, %ymm3, %ymm3 +; AVX512-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; AVX512-INFS-NEXT: vfmadd213ps %ymm1, %ymm2, %ymm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v8f32_interp: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213ps %ymm1, %ymm2, %ymm1 +; FMA-NOINFS-NEXT: vfmadd213ps %ymm1, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v8f32_interp: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddps %ymm1, %ymm1, %ymm2, %ymm1 +; FMA4-NOINFS-NEXT: vfmaddps %ymm1, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v8f32_interp: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213ps %ymm1, %ymm2, %ymm1 +; AVX512-NOINFS-NEXT: vfmadd213ps %ymm1, %ymm2, %ymm0 +; AVX512-NOINFS-NEXT: retq %t1 = fsub <8 x float> , %t %tx = fmul <8 x float> %x, %t %ty = fmul <8 x float> %y, %t1 @@ -943,29 +1181,47 @@ } define double @test_f64_interp(double %x, double %y, double %t) { -; FMA-LABEL: test_f64_interp: -; FMA: # BB#0: -; FMA-NEXT: vmovsd {{.*#+}} xmm3 = mem[0],zero -; FMA-NEXT: vsubsd %xmm2, %xmm3, %xmm3 -; FMA-NEXT: vmulsd %xmm3, %xmm1, %xmm1 -; FMA-NEXT: vfmadd213sd %xmm1, %xmm2, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_f64_interp: -; FMA4: # BB#0: -; FMA4-NEXT: vmovsd {{.*#+}} xmm3 = mem[0],zero -; FMA4-NEXT: vsubsd %xmm2, %xmm3, %xmm3 -; FMA4-NEXT: vmulsd %xmm3, %xmm1, %xmm1 -; FMA4-NEXT: vfmaddsd %xmm1, %xmm2, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_f64_interp: -; AVX512: # BB#0: -; AVX512-NEXT: vmovsd {{.*#+}} xmm3 = mem[0],zero -; AVX512-NEXT: vsubsd %xmm2, %xmm3, %xmm3 -; AVX512-NEXT: vmulsd %xmm3, %xmm1, %xmm1 -; AVX512-NEXT: vfmadd213sd %xmm1, %xmm2, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_f64_interp: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovsd {{.*#+}} xmm3 = mem[0],zero +; FMA-INFS-NEXT: vsubsd %xmm2, %xmm3, %xmm3 +; FMA-INFS-NEXT: vmulsd %xmm3, %xmm1, %xmm1 +; FMA-INFS-NEXT: vfmadd213sd %xmm1, %xmm2, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_f64_interp: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovsd {{.*#+}} xmm3 = mem[0],zero +; FMA4-INFS-NEXT: vsubsd %xmm2, %xmm3, %xmm3 +; FMA4-INFS-NEXT: vmulsd %xmm3, %xmm1, %xmm1 +; FMA4-INFS-NEXT: vfmaddsd %xmm1, %xmm2, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_f64_interp: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vmovsd {{.*#+}} xmm3 = mem[0],zero +; AVX512-INFS-NEXT: vsubsd %xmm2, %xmm3, %xmm3 +; AVX512-INFS-NEXT: vmulsd %xmm3, %xmm1, %xmm1 +; AVX512-INFS-NEXT: vfmadd213sd %xmm1, %xmm2, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_f64_interp: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213sd %xmm1, %xmm2, %xmm1 +; FMA-NOINFS-NEXT: vfmadd213sd %xmm1, %xmm2, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_f64_interp: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddsd %xmm1, %xmm1, %xmm2, %xmm1 +; FMA4-NOINFS-NEXT: vfmaddsd %xmm1, %xmm2, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_f64_interp: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213sd %xmm1, %xmm2, %xmm1 +; AVX512-NOINFS-NEXT: vfmadd213sd %xmm1, %xmm2, %xmm0 +; AVX512-NOINFS-NEXT: retq %t1 = fsub double 1.0, %t %tx = fmul double %x, %t %ty = fmul double %y, %t1 @@ -974,29 +1230,47 @@ } define <2 x double> @test_v2f64_interp(<2 x double> %x, <2 x double> %y, <2 x double> %t) { -; FMA-LABEL: test_v2f64_interp: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00] -; FMA-NEXT: vsubpd %xmm2, %xmm3, %xmm3 -; FMA-NEXT: vmulpd %xmm3, %xmm1, %xmm1 -; FMA-NEXT: vfmadd213pd %xmm1, %xmm2, %xmm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v2f64_interp: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubpd %xmm2, %xmm3, %xmm3 -; FMA4-NEXT: vmulpd %xmm3, %xmm1, %xmm1 -; FMA4-NEXT: vfmaddpd %xmm1, %xmm2, %xmm0, %xmm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v2f64_interp: -; AVX512: # BB#0: -; AVX512-NEXT: vmovapd {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00] -; AVX512-NEXT: vsubpd %xmm2, %xmm3, %xmm3 -; AVX512-NEXT: vmulpd %xmm3, %xmm1, %xmm1 -; AVX512-NEXT: vfmadd213pd %xmm1, %xmm2, %xmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v2f64_interp: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vsubpd %xmm2, %xmm3, %xmm3 +; FMA-INFS-NEXT: vmulpd %xmm3, %xmm1, %xmm1 +; FMA-INFS-NEXT: vfmadd213pd %xmm1, %xmm2, %xmm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v2f64_interp: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubpd %xmm2, %xmm3, %xmm3 +; FMA4-INFS-NEXT: vmulpd %xmm3, %xmm1, %xmm1 +; FMA4-INFS-NEXT: vfmaddpd %xmm1, %xmm2, %xmm0, %xmm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v2f64_interp: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vmovapd {{.*#+}} xmm3 = [1.000000e+00,1.000000e+00] +; AVX512-INFS-NEXT: vsubpd %xmm2, %xmm3, %xmm3 +; AVX512-INFS-NEXT: vmulpd %xmm3, %xmm1, %xmm1 +; AVX512-INFS-NEXT: vfmadd213pd %xmm1, %xmm2, %xmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v2f64_interp: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213pd %xmm1, %xmm2, %xmm1 +; FMA-NOINFS-NEXT: vfmadd213pd %xmm1, %xmm2, %xmm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v2f64_interp: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddpd %xmm1, %xmm1, %xmm2, %xmm1 +; FMA4-NOINFS-NEXT: vfmaddpd %xmm1, %xmm2, %xmm0, %xmm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v2f64_interp: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213pd %xmm1, %xmm2, %xmm1 +; AVX512-NOINFS-NEXT: vfmadd213pd %xmm1, %xmm2, %xmm0 +; AVX512-NOINFS-NEXT: retq %t1 = fsub <2 x double> , %t %tx = fmul <2 x double> %x, %t %ty = fmul <2 x double> %y, %t1 @@ -1005,29 +1279,47 @@ } define <4 x double> @test_v4f64_interp(<4 x double> %x, <4 x double> %y, <4 x double> %t) { -; FMA-LABEL: test_v4f64_interp: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} ymm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA-NEXT: vsubpd %ymm2, %ymm3, %ymm3 -; FMA-NEXT: vmulpd %ymm3, %ymm1, %ymm1 -; FMA-NEXT: vfmadd213pd %ymm1, %ymm2, %ymm0 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v4f64_interp: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} ymm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubpd %ymm2, %ymm3, %ymm3 -; FMA4-NEXT: vmulpd %ymm3, %ymm1, %ymm1 -; FMA4-NEXT: vfmaddpd %ymm1, %ymm2, %ymm0, %ymm0 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v4f64_interp: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastsd {{.*}}(%rip), %ymm3 -; AVX512-NEXT: vsubpd %ymm2, %ymm3, %ymm3 -; AVX512-NEXT: vmulpd %ymm3, %ymm1, %ymm1 -; AVX512-NEXT: vfmadd213pd %ymm1, %ymm2, %ymm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v4f64_interp: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} ymm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vsubpd %ymm2, %ymm3, %ymm3 +; FMA-INFS-NEXT: vmulpd %ymm3, %ymm1, %ymm1 +; FMA-INFS-NEXT: vfmadd213pd %ymm1, %ymm2, %ymm0 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v4f64_interp: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} ymm3 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubpd %ymm2, %ymm3, %ymm3 +; FMA4-INFS-NEXT: vmulpd %ymm3, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vfmaddpd %ymm1, %ymm2, %ymm0, %ymm0 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v4f64_interp: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastsd {{.*}}(%rip), %ymm3 +; AVX512-INFS-NEXT: vsubpd %ymm2, %ymm3, %ymm3 +; AVX512-INFS-NEXT: vmulpd %ymm3, %ymm1, %ymm1 +; AVX512-INFS-NEXT: vfmadd213pd %ymm1, %ymm2, %ymm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v4f64_interp: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213pd %ymm1, %ymm2, %ymm1 +; FMA-NOINFS-NEXT: vfmadd213pd %ymm1, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v4f64_interp: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddpd %ymm1, %ymm1, %ymm2, %ymm1 +; FMA4-NOINFS-NEXT: vfmaddpd %ymm1, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v4f64_interp: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213pd %ymm1, %ymm2, %ymm1 +; AVX512-NOINFS-NEXT: vfmadd213pd %ymm1, %ymm2, %ymm0 +; AVX512-NOINFS-NEXT: retq %t1 = fsub <4 x double> , %t %tx = fmul <4 x double> %x, %t %ty = fmul <4 x double> %y, %t1 Index: test/CodeGen/X86/fma_patterns_wide.ll =================================================================== --- test/CodeGen/X86/fma_patterns_wide.ll +++ test/CodeGen/X86/fma_patterns_wide.ll @@ -1,8 +1,12 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma -fp-contract=fast | FileCheck %s --check-prefix=FMA -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast | FileCheck %s --check-prefix=FMA4 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4 -fp-contract=fast | FileCheck %s --check-prefix=FMA4 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq -fp-contract=fast | FileCheck %s --check-prefix=AVX512 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma -fp-contract=fast | FileCheck %s --check-prefix=FMA --check-prefix=FMA-INFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast | FileCheck %s --check-prefix=FMA4 --check-prefix=FMA4-INFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4 -fp-contract=fast | FileCheck %s --check-prefix=FMA4 --check-prefix=FMA4-INFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq -fp-contract=fast | FileCheck %s --check-prefix=AVX512 --check-prefix=AVX512-INFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma -fp-contract=fast -enable-no-infs-fp-math | FileCheck %s --check-prefix=FMA --check-prefix=FMA-NOINFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast -enable-no-infs-fp-math | FileCheck %s --check-prefix=FMA4 --check-prefix=FMA4-NOINFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4 -fp-contract=fast -enable-no-infs-fp-math | FileCheck %s --check-prefix=FMA4 --check-prefix=FMA4-NOINFS +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq -fp-contract=fast -enable-no-infs-fp-math | FileCheck %s --check-prefix=AVX512 --check-prefix=AVX512-NOINFS ; ; Pattern: (fadd (fmul x, y), z) -> (fmadd x,y,z) @@ -253,352 +257,556 @@ ; define <16 x float> @test_v16f32_mul_add_x_one_y(<16 x float> %x, <16 x float> %y) { -; FMA-LABEL: test_v16f32_mul_add_x_one_y: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} ymm4 = [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-NEXT: vaddps %ymm4, %ymm1, %ymm1 -; FMA-NEXT: vaddps %ymm4, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v16f32_mul_add_x_one_y: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vaddps %ymm4, %ymm1, %ymm1 -; FMA4-NEXT: vaddps %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v16f32_mul_add_x_one_y: -; AVX512: # BB#0: -; AVX512-NEXT: vaddps {{.*}}(%rip){1to16}, %zmm0, %zmm0 -; AVX512-NEXT: vmulps %zmm1, %zmm0, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v16f32_mul_add_x_one_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [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-INFS-NEXT: vaddps %ymm4, %ymm1, %ymm1 +; FMA-INFS-NEXT: vaddps %ymm4, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v16f32_mul_add_x_one_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vaddps %ymm4, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vaddps %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v16f32_mul_add_x_one_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vaddps {{.*}}(%rip){1to16}, %zmm0, %zmm0 +; AVX512-INFS-NEXT: vmulps %zmm1, %zmm0, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v16f32_mul_add_x_one_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmadd213ps %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfmadd213ps %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v16f32_mul_add_x_one_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmaddps %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmaddps %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v16f32_mul_add_x_one_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmadd213ps %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %a = fadd <16 x float> %x, %m = fmul <16 x float> %a, %y ret <16 x float> %m } define <8 x double> @test_v8f64_mul_y_add_x_one(<8 x double> %x, <8 x double> %y) { -; FMA-LABEL: test_v8f64_mul_y_add_x_one: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA-NEXT: vaddpd %ymm4, %ymm1, %ymm1 -; FMA-NEXT: vaddpd %ymm4, %ymm0, %ymm0 -; FMA-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v8f64_mul_y_add_x_one: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vaddpd %ymm4, %ymm1, %ymm1 -; FMA4-NEXT: vaddpd %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA4-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v8f64_mul_y_add_x_one: -; AVX512: # BB#0: -; AVX512-NEXT: vaddpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 -; AVX512-NEXT: vmulpd %zmm0, %zmm1, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v8f64_mul_y_add_x_one: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vaddpd %ymm4, %ymm1, %ymm1 +; FMA-INFS-NEXT: vaddpd %ymm4, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v8f64_mul_y_add_x_one: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vaddpd %ymm4, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vaddpd %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v8f64_mul_y_add_x_one: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vaddpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 +; AVX512-INFS-NEXT: vmulpd %zmm0, %zmm1, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v8f64_mul_y_add_x_one: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmadd213pd %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfmadd213pd %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v8f64_mul_y_add_x_one: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmaddpd %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmaddpd %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v8f64_mul_y_add_x_one: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmadd213pd %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %a = fadd <8 x double> %x, %m = fmul <8 x double> %y, %a ret <8 x double> %m } define <16 x float> @test_v16f32_mul_add_x_negone_y(<16 x float> %x, <16 x float> %y) { -; FMA-LABEL: test_v16f32_mul_add_x_negone_y: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} ymm4 = [-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-NEXT: vaddps %ymm4, %ymm1, %ymm1 -; FMA-NEXT: vaddps %ymm4, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v16f32_mul_add_x_negone_y: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA4-NEXT: vaddps %ymm4, %ymm1, %ymm1 -; FMA4-NEXT: vaddps %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v16f32_mul_add_x_negone_y: -; AVX512: # BB#0: -; AVX512-NEXT: vaddps {{.*}}(%rip){1to16}, %zmm0, %zmm0 -; AVX512-NEXT: vmulps %zmm1, %zmm0, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v16f32_mul_add_x_negone_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [-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-INFS-NEXT: vaddps %ymm4, %ymm1, %ymm1 +; FMA-INFS-NEXT: vaddps %ymm4, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v16f32_mul_add_x_negone_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA4-INFS-NEXT: vaddps %ymm4, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vaddps %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v16f32_mul_add_x_negone_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vaddps {{.*}}(%rip){1to16}, %zmm0, %zmm0 +; AVX512-INFS-NEXT: vmulps %zmm1, %zmm0, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v16f32_mul_add_x_negone_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmsub213ps %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfmsub213ps %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v16f32_mul_add_x_negone_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmsubps %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmsubps %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v16f32_mul_add_x_negone_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmsub213ps %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %a = fadd <16 x float> %x, %m = fmul <16 x float> %a, %y ret <16 x float> %m } define <8 x double> @test_v8f64_mul_y_add_x_negone(<8 x double> %x, <8 x double> %y) { -; FMA-LABEL: test_v8f64_mul_y_add_x_negone: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA-NEXT: vaddpd %ymm4, %ymm1, %ymm1 -; FMA-NEXT: vaddpd %ymm4, %ymm0, %ymm0 -; FMA-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v8f64_mul_y_add_x_negone: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA4-NEXT: vaddpd %ymm4, %ymm1, %ymm1 -; FMA4-NEXT: vaddpd %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA4-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v8f64_mul_y_add_x_negone: -; AVX512: # BB#0: -; AVX512-NEXT: vaddpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 -; AVX512-NEXT: vmulpd %zmm0, %zmm1, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v8f64_mul_y_add_x_negone: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA-INFS-NEXT: vaddpd %ymm4, %ymm1, %ymm1 +; FMA-INFS-NEXT: vaddpd %ymm4, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v8f64_mul_y_add_x_negone: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA4-INFS-NEXT: vaddpd %ymm4, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vaddpd %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v8f64_mul_y_add_x_negone: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vaddpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 +; AVX512-INFS-NEXT: vmulpd %zmm0, %zmm1, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v8f64_mul_y_add_x_negone: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmsub213pd %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfmsub213pd %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v8f64_mul_y_add_x_negone: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmsubpd %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmsubpd %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v8f64_mul_y_add_x_negone: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmsub213pd %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %a = fadd <8 x double> %x, %m = fmul <8 x double> %y, %a ret <8 x double> %m } define <16 x float> @test_v16f32_mul_sub_one_x_y(<16 x float> %x, <16 x float> %y) { -; FMA-LABEL: test_v16f32_mul_sub_one_x_y: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} ymm4 = [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-NEXT: vsubps %ymm1, %ymm4, %ymm1 -; FMA-NEXT: vsubps %ymm0, %ymm4, %ymm0 -; FMA-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v16f32_mul_sub_one_x_y: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubps %ymm1, %ymm4, %ymm1 -; FMA4-NEXT: vsubps %ymm0, %ymm4, %ymm0 -; FMA4-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v16f32_mul_sub_one_x_y: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %zmm2 -; AVX512-NEXT: vsubps %zmm0, %zmm2, %zmm0 -; AVX512-NEXT: vmulps %zmm1, %zmm0, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v16f32_mul_sub_one_x_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [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-INFS-NEXT: vsubps %ymm1, %ymm4, %ymm1 +; FMA-INFS-NEXT: vsubps %ymm0, %ymm4, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v16f32_mul_sub_one_x_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubps %ymm1, %ymm4, %ymm1 +; FMA4-INFS-NEXT: vsubps %ymm0, %ymm4, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v16f32_mul_sub_one_x_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %zmm2 +; AVX512-INFS-NEXT: vsubps %zmm0, %zmm2, %zmm0 +; AVX512-INFS-NEXT: vmulps %zmm1, %zmm0, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v16f32_mul_sub_one_x_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213ps %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfnmadd213ps %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v16f32_mul_sub_one_x_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddps %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfnmaddps %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v16f32_mul_sub_one_x_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213ps %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <16 x float> , %x %m = fmul <16 x float> %s, %y ret <16 x float> %m } define <8 x double> @test_v8f64_mul_y_sub_one_x(<8 x double> %x, <8 x double> %y) { -; FMA-LABEL: test_v8f64_mul_y_sub_one_x: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA-NEXT: vsubpd %ymm1, %ymm4, %ymm1 -; FMA-NEXT: vsubpd %ymm0, %ymm4, %ymm0 -; FMA-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v8f64_mul_y_sub_one_x: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubpd %ymm1, %ymm4, %ymm1 -; FMA4-NEXT: vsubpd %ymm0, %ymm4, %ymm0 -; FMA4-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA4-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v8f64_mul_y_sub_one_x: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastsd {{.*}}(%rip), %zmm2 -; AVX512-NEXT: vsubpd %zmm0, %zmm2, %zmm0 -; AVX512-NEXT: vmulpd %zmm0, %zmm1, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v8f64_mul_y_sub_one_x: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vsubpd %ymm1, %ymm4, %ymm1 +; FMA-INFS-NEXT: vsubpd %ymm0, %ymm4, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v8f64_mul_y_sub_one_x: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubpd %ymm1, %ymm4, %ymm1 +; FMA4-INFS-NEXT: vsubpd %ymm0, %ymm4, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v8f64_mul_y_sub_one_x: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastsd {{.*}}(%rip), %zmm2 +; AVX512-INFS-NEXT: vsubpd %zmm0, %zmm2, %zmm0 +; AVX512-INFS-NEXT: vmulpd %zmm0, %zmm1, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v8f64_mul_y_sub_one_x: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213pd %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfnmadd213pd %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v8f64_mul_y_sub_one_x: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddpd %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfnmaddpd %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v8f64_mul_y_sub_one_x: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213pd %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <8 x double> , %x %m = fmul <8 x double> %y, %s ret <8 x double> %m } define <16 x float> @test_v16f32_mul_sub_negone_x_y(<16 x float> %x, <16 x float> %y) { -; FMA-LABEL: test_v16f32_mul_sub_negone_x_y: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} ymm4 = [-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-NEXT: vsubps %ymm1, %ymm4, %ymm1 -; FMA-NEXT: vsubps %ymm0, %ymm4, %ymm0 -; FMA-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v16f32_mul_sub_negone_x_y: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA4-NEXT: vsubps %ymm1, %ymm4, %ymm1 -; FMA4-NEXT: vsubps %ymm0, %ymm4, %ymm0 -; FMA4-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v16f32_mul_sub_negone_x_y: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %zmm2 -; AVX512-NEXT: vsubps %zmm0, %zmm2, %zmm0 -; AVX512-NEXT: vmulps %zmm1, %zmm0, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v16f32_mul_sub_negone_x_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [-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-INFS-NEXT: vsubps %ymm1, %ymm4, %ymm1 +; FMA-INFS-NEXT: vsubps %ymm0, %ymm4, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v16f32_mul_sub_negone_x_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA4-INFS-NEXT: vsubps %ymm1, %ymm4, %ymm1 +; FMA4-INFS-NEXT: vsubps %ymm0, %ymm4, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v16f32_mul_sub_negone_x_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %zmm2 +; AVX512-INFS-NEXT: vsubps %zmm0, %zmm2, %zmm0 +; AVX512-INFS-NEXT: vmulps %zmm1, %zmm0, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v16f32_mul_sub_negone_x_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmsub213ps %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfnmsub213ps %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v16f32_mul_sub_negone_x_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmsubps %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfnmsubps %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v16f32_mul_sub_negone_x_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmsub213ps %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <16 x float> , %x %m = fmul <16 x float> %s, %y ret <16 x float> %m } define <8 x double> @test_v8f64_mul_y_sub_negone_x(<8 x double> %x, <8 x double> %y) { -; FMA-LABEL: test_v8f64_mul_y_sub_negone_x: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA-NEXT: vsubpd %ymm1, %ymm4, %ymm1 -; FMA-NEXT: vsubpd %ymm0, %ymm4, %ymm0 -; FMA-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v8f64_mul_y_sub_negone_x: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA4-NEXT: vsubpd %ymm1, %ymm4, %ymm1 -; FMA4-NEXT: vsubpd %ymm0, %ymm4, %ymm0 -; FMA4-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA4-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v8f64_mul_y_sub_negone_x: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastsd {{.*}}(%rip), %zmm2 -; AVX512-NEXT: vsubpd %zmm0, %zmm2, %zmm0 -; AVX512-NEXT: vmulpd %zmm0, %zmm1, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v8f64_mul_y_sub_negone_x: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA-INFS-NEXT: vsubpd %ymm1, %ymm4, %ymm1 +; FMA-INFS-NEXT: vsubpd %ymm0, %ymm4, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v8f64_mul_y_sub_negone_x: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA4-INFS-NEXT: vsubpd %ymm1, %ymm4, %ymm1 +; FMA4-INFS-NEXT: vsubpd %ymm0, %ymm4, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v8f64_mul_y_sub_negone_x: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastsd {{.*}}(%rip), %zmm2 +; AVX512-INFS-NEXT: vsubpd %zmm0, %zmm2, %zmm0 +; AVX512-INFS-NEXT: vmulpd %zmm0, %zmm1, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v8f64_mul_y_sub_negone_x: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmsub213pd %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfnmsub213pd %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v8f64_mul_y_sub_negone_x: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmsubpd %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfnmsubpd %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v8f64_mul_y_sub_negone_x: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmsub213pd %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <8 x double> , %x %m = fmul <8 x double> %y, %s ret <8 x double> %m } define <16 x float> @test_v16f32_mul_sub_x_one_y(<16 x float> %x, <16 x float> %y) { -; FMA-LABEL: test_v16f32_mul_sub_x_one_y: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} ymm4 = [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-NEXT: vsubps %ymm4, %ymm1, %ymm1 -; FMA-NEXT: vsubps %ymm4, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v16f32_mul_sub_x_one_y: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubps %ymm4, %ymm1, %ymm1 -; FMA4-NEXT: vsubps %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v16f32_mul_sub_x_one_y: -; AVX512: # BB#0: -; AVX512-NEXT: vsubps {{.*}}(%rip){1to16}, %zmm0, %zmm0 -; AVX512-NEXT: vmulps %zmm1, %zmm0, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v16f32_mul_sub_x_one_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [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-INFS-NEXT: vsubps %ymm4, %ymm1, %ymm1 +; FMA-INFS-NEXT: vsubps %ymm4, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v16f32_mul_sub_x_one_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubps %ymm4, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vsubps %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v16f32_mul_sub_x_one_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vsubps {{.*}}(%rip){1to16}, %zmm0, %zmm0 +; AVX512-INFS-NEXT: vmulps %zmm1, %zmm0, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v16f32_mul_sub_x_one_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmsub213ps %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfmsub213ps %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v16f32_mul_sub_x_one_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmsubps %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmsubps %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v16f32_mul_sub_x_one_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmsub213ps %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <16 x float> %x, %m = fmul <16 x float> %s, %y ret <16 x float> %m } define <8 x double> @test_v8f64_mul_y_sub_x_one(<8 x double> %x, <8 x double> %y) { -; FMA-LABEL: test_v8f64_mul_y_sub_x_one: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA-NEXT: vsubpd %ymm4, %ymm1, %ymm1 -; FMA-NEXT: vsubpd %ymm4, %ymm0, %ymm0 -; FMA-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v8f64_mul_y_sub_x_one: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubpd %ymm4, %ymm1, %ymm1 -; FMA4-NEXT: vsubpd %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA4-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v8f64_mul_y_sub_x_one: -; AVX512: # BB#0: -; AVX512-NEXT: vsubpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 -; AVX512-NEXT: vmulpd %zmm0, %zmm1, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v8f64_mul_y_sub_x_one: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vsubpd %ymm4, %ymm1, %ymm1 +; FMA-INFS-NEXT: vsubpd %ymm4, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v8f64_mul_y_sub_x_one: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubpd %ymm4, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vsubpd %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v8f64_mul_y_sub_x_one: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vsubpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 +; AVX512-INFS-NEXT: vmulpd %zmm0, %zmm1, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v8f64_mul_y_sub_x_one: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmsub213pd %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfmsub213pd %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v8f64_mul_y_sub_x_one: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmsubpd %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmsubpd %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v8f64_mul_y_sub_x_one: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmsub213pd %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <8 x double> %x, %m = fmul <8 x double> %y, %s ret <8 x double> %m } define <16 x float> @test_v16f32_mul_sub_x_negone_y(<16 x float> %x, <16 x float> %y) { -; FMA-LABEL: test_v16f32_mul_sub_x_negone_y: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} ymm4 = [-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-NEXT: vsubps %ymm4, %ymm1, %ymm1 -; FMA-NEXT: vsubps %ymm4, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v16f32_mul_sub_x_negone_y: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA4-NEXT: vsubps %ymm4, %ymm1, %ymm1 -; FMA4-NEXT: vsubps %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm2, %ymm0, %ymm0 -; FMA4-NEXT: vmulps %ymm3, %ymm1, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v16f32_mul_sub_x_negone_y: -; AVX512: # BB#0: -; AVX512-NEXT: vsubps {{.*}}(%rip){1to16}, %zmm0, %zmm0 -; AVX512-NEXT: vmulps %zmm1, %zmm0, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v16f32_mul_sub_x_negone_y: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [-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-INFS-NEXT: vsubps %ymm4, %ymm1, %ymm1 +; FMA-INFS-NEXT: vsubps %ymm4, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v16f32_mul_sub_x_negone_y: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA4-INFS-NEXT: vsubps %ymm4, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vsubps %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm2, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulps %ymm3, %ymm1, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v16f32_mul_sub_x_negone_y: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vsubps {{.*}}(%rip){1to16}, %zmm0, %zmm0 +; AVX512-INFS-NEXT: vmulps %zmm1, %zmm0, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v16f32_mul_sub_x_negone_y: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmadd213ps %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfmadd213ps %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v16f32_mul_sub_x_negone_y: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmaddps %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmaddps %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v16f32_mul_sub_x_negone_y: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmadd213ps %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <16 x float> %x, %m = fmul <16 x float> %s, %y ret <16 x float> %m } define <8 x double> @test_v8f64_mul_y_sub_x_negone(<8 x double> %x, <8 x double> %y) { -; FMA-LABEL: test_v8f64_mul_y_sub_x_negone: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA-NEXT: vsubpd %ymm4, %ymm1, %ymm1 -; FMA-NEXT: vsubpd %ymm4, %ymm0, %ymm0 -; FMA-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v8f64_mul_y_sub_x_negone: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] -; FMA4-NEXT: vsubpd %ymm4, %ymm1, %ymm1 -; FMA4-NEXT: vsubpd %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vmulpd %ymm0, %ymm2, %ymm0 -; FMA4-NEXT: vmulpd %ymm1, %ymm3, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v8f64_mul_y_sub_x_negone: -; AVX512: # BB#0: -; AVX512-NEXT: vsubpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 -; AVX512-NEXT: vmulpd %zmm0, %zmm1, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v8f64_mul_y_sub_x_negone: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA-INFS-NEXT: vsubpd %ymm4, %ymm1, %ymm1 +; FMA-INFS-NEXT: vsubpd %ymm4, %ymm0, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v8f64_mul_y_sub_x_negone: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} ymm4 = [-1.000000e+00,-1.000000e+00,-1.000000e+00,-1.000000e+00] +; FMA4-INFS-NEXT: vsubpd %ymm4, %ymm1, %ymm1 +; FMA4-INFS-NEXT: vsubpd %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm0, %ymm2, %ymm0 +; FMA4-INFS-NEXT: vmulpd %ymm1, %ymm3, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v8f64_mul_y_sub_x_negone: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vsubpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 +; AVX512-INFS-NEXT: vmulpd %zmm0, %zmm1, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v8f64_mul_y_sub_x_negone: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfmadd213pd %ymm2, %ymm2, %ymm0 +; FMA-NOINFS-NEXT: vfmadd213pd %ymm3, %ymm3, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v8f64_mul_y_sub_x_negone: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfmaddpd %ymm2, %ymm2, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmaddpd %ymm3, %ymm3, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v8f64_mul_y_sub_x_negone: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfmadd213pd %zmm1, %zmm1, %zmm0 +; AVX512-NOINFS-NEXT: retq %s = fsub <8 x double> %x, %m = fmul <8 x double> %y, %s ret <8 x double> %m @@ -609,35 +817,57 @@ ; define <16 x float> @test_v16f32_interp(<16 x float> %x, <16 x float> %y, <16 x float> %t) { -; FMA-LABEL: test_v16f32_interp: -; FMA: # BB#0: -; FMA-NEXT: vmovaps {{.*#+}} ymm6 = [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-NEXT: vsubps %ymm4, %ymm6, %ymm7 -; FMA-NEXT: vsubps %ymm5, %ymm6, %ymm6 -; FMA-NEXT: vmulps %ymm6, %ymm3, %ymm3 -; FMA-NEXT: vmulps %ymm7, %ymm2, %ymm2 -; FMA-NEXT: vfmadd213ps %ymm2, %ymm4, %ymm0 -; FMA-NEXT: vfmadd213ps %ymm3, %ymm5, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v16f32_interp: -; FMA4: # BB#0: -; FMA4-NEXT: vmovaps {{.*#+}} ymm6 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubps %ymm4, %ymm6, %ymm7 -; FMA4-NEXT: vsubps %ymm5, %ymm6, %ymm6 -; FMA4-NEXT: vmulps %ymm6, %ymm3, %ymm3 -; FMA4-NEXT: vmulps %ymm7, %ymm2, %ymm2 -; FMA4-NEXT: vfmaddps %ymm2, %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vfmaddps %ymm3, %ymm5, %ymm1, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v16f32_interp: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastss {{.*}}(%rip), %zmm3 -; AVX512-NEXT: vsubps %zmm2, %zmm3, %zmm3 -; AVX512-NEXT: vmulps %zmm3, %zmm1, %zmm1 -; AVX512-NEXT: vfmadd213ps %zmm1, %zmm2, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v16f32_interp: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovaps {{.*#+}} ymm6 = [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-INFS-NEXT: vsubps %ymm4, %ymm6, %ymm7 +; FMA-INFS-NEXT: vsubps %ymm5, %ymm6, %ymm6 +; FMA-INFS-NEXT: vmulps %ymm6, %ymm3, %ymm3 +; FMA-INFS-NEXT: vmulps %ymm7, %ymm2, %ymm2 +; FMA-INFS-NEXT: vfmadd213ps %ymm2, %ymm4, %ymm0 +; FMA-INFS-NEXT: vfmadd213ps %ymm3, %ymm5, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v16f32_interp: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovaps {{.*#+}} ymm6 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubps %ymm4, %ymm6, %ymm7 +; FMA4-INFS-NEXT: vsubps %ymm5, %ymm6, %ymm6 +; FMA4-INFS-NEXT: vmulps %ymm6, %ymm3, %ymm3 +; FMA4-INFS-NEXT: vmulps %ymm7, %ymm2, %ymm2 +; FMA4-INFS-NEXT: vfmaddps %ymm2, %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vfmaddps %ymm3, %ymm5, %ymm1, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v16f32_interp: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastss {{.*}}(%rip), %zmm3 +; AVX512-INFS-NEXT: vsubps %zmm2, %zmm3, %zmm3 +; AVX512-INFS-NEXT: vmulps %zmm3, %zmm1, %zmm1 +; AVX512-INFS-NEXT: vfmadd213ps %zmm1, %zmm2, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v16f32_interp: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213ps %ymm3, %ymm5, %ymm3 +; FMA-NOINFS-NEXT: vfnmadd213ps %ymm2, %ymm4, %ymm2 +; FMA-NOINFS-NEXT: vfmadd213ps %ymm2, %ymm4, %ymm0 +; FMA-NOINFS-NEXT: vfmadd213ps %ymm3, %ymm5, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v16f32_interp: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddps %ymm3, %ymm3, %ymm5, %ymm3 +; FMA4-NOINFS-NEXT: vfnmaddps %ymm2, %ymm2, %ymm4, %ymm2 +; FMA4-NOINFS-NEXT: vfmaddps %ymm2, %ymm4, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmaddps %ymm3, %ymm5, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v16f32_interp: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213ps %zmm1, %zmm2, %zmm1 +; AVX512-NOINFS-NEXT: vfmadd213ps %zmm1, %zmm2, %zmm0 +; AVX512-NOINFS-NEXT: retq %t1 = fsub <16 x float> , %t %tx = fmul <16 x float> %x, %t %ty = fmul <16 x float> %y, %t1 @@ -646,35 +876,57 @@ } define <8 x double> @test_v8f64_interp(<8 x double> %x, <8 x double> %y, <8 x double> %t) { -; FMA-LABEL: test_v8f64_interp: -; FMA: # BB#0: -; FMA-NEXT: vmovapd {{.*#+}} ymm6 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA-NEXT: vsubpd %ymm4, %ymm6, %ymm7 -; FMA-NEXT: vsubpd %ymm5, %ymm6, %ymm6 -; FMA-NEXT: vmulpd %ymm6, %ymm3, %ymm3 -; FMA-NEXT: vmulpd %ymm7, %ymm2, %ymm2 -; FMA-NEXT: vfmadd213pd %ymm2, %ymm4, %ymm0 -; FMA-NEXT: vfmadd213pd %ymm3, %ymm5, %ymm1 -; FMA-NEXT: retq -; -; FMA4-LABEL: test_v8f64_interp: -; FMA4: # BB#0: -; FMA4-NEXT: vmovapd {{.*#+}} ymm6 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] -; FMA4-NEXT: vsubpd %ymm4, %ymm6, %ymm7 -; FMA4-NEXT: vsubpd %ymm5, %ymm6, %ymm6 -; FMA4-NEXT: vmulpd %ymm6, %ymm3, %ymm3 -; FMA4-NEXT: vmulpd %ymm7, %ymm2, %ymm2 -; FMA4-NEXT: vfmaddpd %ymm2, %ymm4, %ymm0, %ymm0 -; FMA4-NEXT: vfmaddpd %ymm3, %ymm5, %ymm1, %ymm1 -; FMA4-NEXT: retq -; -; AVX512-LABEL: test_v8f64_interp: -; AVX512: # BB#0: -; AVX512-NEXT: vbroadcastsd {{.*}}(%rip), %zmm3 -; AVX512-NEXT: vsubpd %zmm2, %zmm3, %zmm3 -; AVX512-NEXT: vmulpd %zmm3, %zmm1, %zmm1 -; AVX512-NEXT: vfmadd213pd %zmm1, %zmm2, %zmm0 -; AVX512-NEXT: retq +; FMA-INFS-LABEL: test_v8f64_interp: +; FMA-INFS: # BB#0: +; FMA-INFS-NEXT: vmovapd {{.*#+}} ymm6 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA-INFS-NEXT: vsubpd %ymm4, %ymm6, %ymm7 +; FMA-INFS-NEXT: vsubpd %ymm5, %ymm6, %ymm6 +; FMA-INFS-NEXT: vmulpd %ymm6, %ymm3, %ymm3 +; FMA-INFS-NEXT: vmulpd %ymm7, %ymm2, %ymm2 +; FMA-INFS-NEXT: vfmadd213pd %ymm2, %ymm4, %ymm0 +; FMA-INFS-NEXT: vfmadd213pd %ymm3, %ymm5, %ymm1 +; FMA-INFS-NEXT: retq +; +; FMA4-INFS-LABEL: test_v8f64_interp: +; FMA4-INFS: # BB#0: +; FMA4-INFS-NEXT: vmovapd {{.*#+}} ymm6 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00] +; FMA4-INFS-NEXT: vsubpd %ymm4, %ymm6, %ymm7 +; FMA4-INFS-NEXT: vsubpd %ymm5, %ymm6, %ymm6 +; FMA4-INFS-NEXT: vmulpd %ymm6, %ymm3, %ymm3 +; FMA4-INFS-NEXT: vmulpd %ymm7, %ymm2, %ymm2 +; FMA4-INFS-NEXT: vfmaddpd %ymm2, %ymm4, %ymm0, %ymm0 +; FMA4-INFS-NEXT: vfmaddpd %ymm3, %ymm5, %ymm1, %ymm1 +; FMA4-INFS-NEXT: retq +; +; AVX512-INFS-LABEL: test_v8f64_interp: +; AVX512-INFS: # BB#0: +; AVX512-INFS-NEXT: vbroadcastsd {{.*}}(%rip), %zmm3 +; AVX512-INFS-NEXT: vsubpd %zmm2, %zmm3, %zmm3 +; AVX512-INFS-NEXT: vmulpd %zmm3, %zmm1, %zmm1 +; AVX512-INFS-NEXT: vfmadd213pd %zmm1, %zmm2, %zmm0 +; AVX512-INFS-NEXT: retq +; +; FMA-NOINFS-LABEL: test_v8f64_interp: +; FMA-NOINFS: # BB#0: +; FMA-NOINFS-NEXT: vfnmadd213pd %ymm3, %ymm5, %ymm3 +; FMA-NOINFS-NEXT: vfnmadd213pd %ymm2, %ymm4, %ymm2 +; FMA-NOINFS-NEXT: vfmadd213pd %ymm2, %ymm4, %ymm0 +; FMA-NOINFS-NEXT: vfmadd213pd %ymm3, %ymm5, %ymm1 +; FMA-NOINFS-NEXT: retq +; +; FMA4-NOINFS-LABEL: test_v8f64_interp: +; FMA4-NOINFS: # BB#0: +; FMA4-NOINFS-NEXT: vfnmaddpd %ymm3, %ymm3, %ymm5, %ymm3 +; FMA4-NOINFS-NEXT: vfnmaddpd %ymm2, %ymm2, %ymm4, %ymm2 +; FMA4-NOINFS-NEXT: vfmaddpd %ymm2, %ymm4, %ymm0, %ymm0 +; FMA4-NOINFS-NEXT: vfmaddpd %ymm3, %ymm5, %ymm1, %ymm1 +; FMA4-NOINFS-NEXT: retq +; +; AVX512-NOINFS-LABEL: test_v8f64_interp: +; AVX512-NOINFS: # BB#0: +; AVX512-NOINFS-NEXT: vfnmadd213pd %zmm1, %zmm2, %zmm1 +; AVX512-NOINFS-NEXT: vfmadd213pd %zmm1, %zmm2, %zmm0 +; AVX512-NOINFS-NEXT: retq %t1 = fsub <8 x double> , %t %tx = fmul <8 x double> %x, %t %ty = fmul <8 x double> %y, %t1