From 5284f976327d789b9e52089ff684fb36f6d964dd Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 1 Jan 2013 00:11:07 +0000 Subject: [PATCH] Merge AVX/SSE instruction definitions for SQRTPS/PD, RSQRTPS, RCPPS. No funcitonal change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171337 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrSSE.td | 105 +++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index 9082c5a6ea4..6bcbc39298f 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -2974,27 +2974,37 @@ multiclass sse1_fp_unop_s_avx opc, string OpcodeStr> { /// sse1_fp_unop_p - SSE1 unops in packed form. multiclass sse1_fp_unop_p opc, string OpcodeStr, SDNode OpNode, OpndItins itins> { +let Predicates = [HasAVX] in { + def V#NAME#PSr : PSI, VEX; + def V#NAME#PSm : PSI, VEX; + def V#NAME#PSYr : PSI, VEX, VEX_L; + def V#NAME#PSYm : PSI, VEX, VEX_L; +} + def PSr : PSI; + !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), + [(set VR128:$dst, (v4f32 (OpNode VR128:$src)))], itins.rr>; def PSm : PSI; } -/// sse1_fp_unop_p_y - AVX 256-bit SSE1 unops in packed form. -multiclass sse1_fp_unop_p_y opc, string OpcodeStr, SDNode OpNode, - OpndItins itins> { - def PSYr : PSI, VEX_L; - def PSYm : PSI, VEX_L; -} - /// sse1_fp_unop_p_int - SSE1 intrinsics unops in packed forms. multiclass sse1_fp_unop_p_int opc, string OpcodeStr, Intrinsic V4F32Int, OpndItins itins> { @@ -3045,7 +3055,7 @@ let hasSideEffects = 0 in multiclass sse2_fp_unop_s_avx opc, string OpcodeStr> { def SDr : SDI; + "sd\t{$src2, $src1, $dst|$dst, $src1, $src2}"), []>; let mayLoad = 1 in { def SDm : SDI opc, string OpcodeStr> { } } -/// sse2_fp_unop_p - SSE2 unops in vector forms. +/// sse2_fp_unop_p_new - SSE2 unops in vector forms. multiclass sse2_fp_unop_p opc, string OpcodeStr, SDNode OpNode, OpndItins itins> { +let Predicates = [HasAVX] in { + def V#NAME#PDr : PDI, VEX; + def V#NAME#PDm : PDI, VEX; + def V#NAME#PDYr : PDI, VEX, VEX_L; + def V#NAME#PDYm : PDI, VEX, VEX_L; +} + def PDr : PDI; @@ -3068,19 +3101,6 @@ multiclass sse2_fp_unop_p opc, string OpcodeStr, [(set VR128:$dst, (OpNode (memopv2f64 addr:$src)))], itins.rm>; } -/// sse2_fp_unop_p_y - AVX SSE2 256-bit unops in vector forms. -multiclass sse2_fp_unop_p_y opc, string OpcodeStr, SDNode OpNode, - OpndItins itins> { - def PDYr : PDI, VEX_L; - def PDYm : PDI, VEX_L; -} - /// sse2_fp_unop_p_int - SSE2 intrinsic unops in vector forms. multiclass sse2_fp_unop_p_int opc, string OpcodeStr, Intrinsic V2F64Int, OpndItins itins> { @@ -3107,31 +3127,26 @@ multiclass sse2_fp_unop_p_y_int opc, string OpcodeStr, itins.rm>, VEX_L; } +defm SQRT : sse1_fp_unop_p<0x51, "sqrt", fsqrt, SSE_SQRTP>, + sse2_fp_unop_p<0x51, "sqrt", fsqrt, SSE_SQRTP>; +defm RSQRT : sse1_fp_unop_p<0x52, "rsqrt", X86frsqrt, SSE_SQRTP>; +defm RCP : sse1_fp_unop_p<0x53, "rcp", X86frcp, SSE_RCPP>; + let Predicates = [HasAVX] in { // Square root. defm VSQRT : sse1_fp_unop_s_avx<0x51, "vsqrt">, sse2_fp_unop_s_avx<0x51, "vsqrt">, VEX_4V, VEX_LIG; - defm VSQRT : sse1_fp_unop_p<0x51, "vsqrt", fsqrt, SSE_SQRTP>, - sse2_fp_unop_p<0x51, "vsqrt", fsqrt, SSE_SQRTP>, - sse1_fp_unop_p_y<0x51, "vsqrt", fsqrt, SSE_SQRTP>, - sse2_fp_unop_p_y<0x51, "vsqrt", fsqrt, SSE_SQRTP>, - VEX; - // Reciprocal approximations. Note that these typically require refinement // in order to obtain suitable precision. defm VRSQRT : sse1_fp_unop_s_avx<0x52, "vrsqrt">, VEX_4V, VEX_LIG; - defm VRSQRT : sse1_fp_unop_p<0x52, "vrsqrt", X86frsqrt, SSE_SQRTP>, - sse1_fp_unop_p_y<0x52, "vrsqrt", X86frsqrt, SSE_SQRTP>, - sse1_fp_unop_p_y_int<0x52, "vrsqrt", int_x86_avx_rsqrt_ps_256, + defm VRSQRT : sse1_fp_unop_p_y_int<0x52, "vrsqrt", int_x86_avx_rsqrt_ps_256, SSE_SQRTP>, sse1_fp_unop_p_int<0x52, "vrsqrt", int_x86_sse_rsqrt_ps, SSE_SQRTP>, VEX; defm VRCP : sse1_fp_unop_s_avx<0x53, "vrcp">, VEX_4V, VEX_LIG; - defm VRCP : sse1_fp_unop_p<0x53, "vrcp", X86frcp, SSE_RCPP>, - sse1_fp_unop_p_y<0x53, "vrcp", X86frcp, SSE_RCPP>, - sse1_fp_unop_p_y_int<0x53, "vrcp", int_x86_avx_rcp_ps_256, + defm VRCP : sse1_fp_unop_p_y_int<0x53, "vrcp", int_x86_avx_rcp_ps_256, SSE_RCPP>, sse1_fp_unop_p_int<0x53, "vrcp", int_x86_sse_rcp_ps, SSE_RCPP>, VEX; @@ -3193,10 +3208,8 @@ let Predicates = [HasAVX] in { // Square root. defm SQRT : sse1_fp_unop_s<0x51, "sqrt", fsqrt, int_x86_sse_sqrt_ss, SSE_SQRTS>, - sse1_fp_unop_p<0x51, "sqrt", fsqrt, SSE_SQRTP>, sse2_fp_unop_s<0x51, "sqrt", fsqrt, int_x86_sse2_sqrt_sd, - SSE_SQRTS>, - sse2_fp_unop_p<0x51, "sqrt", fsqrt, SSE_SQRTP>; + SSE_SQRTS>; /// sse1_fp_unop_s_rw - SSE1 unops where vector form has a read-write operand. multiclass sse1_fp_unop_rw opc, string OpcodeStr, SDNode OpNode, @@ -3229,7 +3242,6 @@ multiclass sse1_fp_unop_rw opc, string OpcodeStr, SDNode OpNode, // in order to obtain suitable precision. defm RSQRT : sse1_fp_unop_rw<0x52, "rsqrt", X86frsqrt, int_x86_sse_rsqrt_ss, SSE_SQRTS>, - sse1_fp_unop_p<0x52, "rsqrt", X86frsqrt, SSE_SQRTP>, sse1_fp_unop_p_int<0x52, "rsqrt", int_x86_sse_rsqrt_ps, SSE_SQRTP>; let Predicates = [UseSSE1] in { @@ -3239,7 +3251,6 @@ let Predicates = [UseSSE1] in { defm RCP : sse1_fp_unop_rw<0x53, "rcp", X86frcp, int_x86_sse_rcp_ss, SSE_RCPS>, - sse1_fp_unop_p<0x53, "rcp", X86frcp, SSE_RCPP>, sse1_fp_unop_p_int<0x53, "rcp", int_x86_sse_rcp_ps, SSE_RCPP>; let Predicates = [UseSSE1] in { def : Pat<(int_x86_sse_rcp_ss VR128:$src), -- 2.34.1