1; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=core-avx2 -mattr=avx2,+fma -fp-contract=fast | FileCheck %s 2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=bdver2 -mattr=-fma4 -fp-contract=fast | FileCheck %s 3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=bdver1 -fp-contract=fast | FileCheck %s --check-prefix=CHECK_FMA4 4 5; CHECK-LABEL: test_x86_fmadd_ps_y_wide 6; CHECK: vfmadd213ps 7; CHECK: vfmadd213ps 8; CHECK: ret 9; CHECK_FMA4-LABEL: test_x86_fmadd_ps_y_wide 10; CHECK_FMA4: vfmaddps 11; CHECK_FMA4: vfmaddps 12; CHECK_FMA4: ret 13define <16 x float> @test_x86_fmadd_ps_y_wide(<16 x float> %a0, <16 x float> %a1, <16 x float> %a2) { 14 %x = fmul <16 x float> %a0, %a1 15 %res = fadd <16 x float> %x, %a2 16 ret <16 x float> %res 17} 18 19; CHECK-LABEL: test_x86_fmsub_ps_y_wide 20; CHECK: vfmsub213ps 21; CHECK: vfmsub213ps 22; CHECK: ret 23; CHECK_FMA4-LABEL: test_x86_fmsub_ps_y_wide 24; CHECK_FMA4: vfmsubps 25; CHECK_FMA4: vfmsubps 26; CHECK_FMA4: ret 27define <16 x float> @test_x86_fmsub_ps_y_wide(<16 x float> %a0, <16 x float> %a1, <16 x float> %a2) { 28 %x = fmul <16 x float> %a0, %a1 29 %res = fsub <16 x float> %x, %a2 30 ret <16 x float> %res 31} 32 33; CHECK-LABEL: test_x86_fnmadd_ps_y_wide 34; CHECK: vfnmadd213ps 35; CHECK: vfnmadd213ps 36; CHECK: ret 37; CHECK_FMA4-LABEL: test_x86_fnmadd_ps_y_wide 38; CHECK_FMA4: vfnmaddps 39; CHECK_FMA4: vfnmaddps 40; CHECK_FMA4: ret 41define <16 x float> @test_x86_fnmadd_ps_y_wide(<16 x float> %a0, <16 x float> %a1, <16 x float> %a2) { 42 %x = fmul <16 x float> %a0, %a1 43 %res = fsub <16 x float> %a2, %x 44 ret <16 x float> %res 45} 46 47; CHECK-LABEL: test_x86_fnmsub_ps_y_wide 48; CHECK: vfnmsub213ps 49; CHECK: vfnmsub213ps 50; CHECK: ret 51define <16 x float> @test_x86_fnmsub_ps_y_wide(<16 x float> %a0, <16 x float> %a1, <16 x float> %a2) { 52 %x = fmul <16 x float> %a0, %a1 53 %y = fsub <16 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %x 54 %res = fsub <16 x float> %y, %a2 55 ret <16 x float> %res 56} 57 58; CHECK-LABEL: test_x86_fmadd_pd_y_wide 59; CHECK: vfmadd213pd 60; CHECK: vfmadd213pd 61; CHECK: ret 62; CHECK_FMA4-LABEL: test_x86_fmadd_pd_y_wide 63; CHECK_FMA4: vfmaddpd 64; CHECK_FMA4: vfmaddpd 65; CHECK_FMA4: ret 66define <8 x double> @test_x86_fmadd_pd_y_wide(<8 x double> %a0, <8 x double> %a1, <8 x double> %a2) { 67 %x = fmul <8 x double> %a0, %a1 68 %res = fadd <8 x double> %x, %a2 69 ret <8 x double> %res 70} 71 72; CHECK-LABEL: test_x86_fmsub_pd_y_wide 73; CHECK: vfmsub213pd 74; CHECK: vfmsub213pd 75; CHECK: ret 76; CHECK_FMA4-LABEL: test_x86_fmsub_pd_y_wide 77; CHECK_FMA4: vfmsubpd 78; CHECK_FMA4: vfmsubpd 79; CHECK_FMA4: ret 80define <8 x double> @test_x86_fmsub_pd_y_wide(<8 x double> %a0, <8 x double> %a1, <8 x double> %a2) { 81 %x = fmul <8 x double> %a0, %a1 82 %res = fsub <8 x double> %x, %a2 83 ret <8 x double> %res 84} 85