x86: Add non-destructive source to @xorsign<mode>3_1
Add non-destructive source alternative to @xorsign<mode>3_1 for AVX. gcc/ PR target/89984 * config/i386/i386-expand.c (ix86_split_xorsign): Use operands[2]. * config/i386/i386.md (@xorsign<mode>3_1): Add non-destructive source alternative for AVX. gcc/testsuite/ PR target/89984 * gcc.target/i386/pr89984-1.c: New test. * gcc.target/i386/pr89984-2.c: Likewise. * gcc.target/i386/xorsign-avx.c: Likewise.
This commit is contained in:
parent
93e6809459
commit
652bef70d3
5 changed files with 36 additions and 10 deletions
|
@ -2279,21 +2279,24 @@ void
|
|||
ix86_split_xorsign (rtx operands[])
|
||||
{
|
||||
machine_mode mode, vmode;
|
||||
rtx dest, op0, mask, x;
|
||||
rtx dest, op0, op1, mask, x;
|
||||
|
||||
dest = operands[0];
|
||||
op0 = operands[1];
|
||||
op1 = operands[2];
|
||||
mask = operands[3];
|
||||
|
||||
mode = GET_MODE (dest);
|
||||
vmode = GET_MODE (mask);
|
||||
|
||||
dest = lowpart_subreg (vmode, dest, mode);
|
||||
x = gen_rtx_AND (vmode, dest, mask);
|
||||
emit_insn (gen_rtx_SET (dest, x));
|
||||
op1 = lowpart_subreg (vmode, op1, mode);
|
||||
x = gen_rtx_AND (vmode, op1, mask);
|
||||
emit_insn (gen_rtx_SET (op1, x));
|
||||
|
||||
op0 = lowpart_subreg (vmode, op0, mode);
|
||||
x = gen_rtx_XOR (vmode, dest, op0);
|
||||
x = gen_rtx_XOR (vmode, op1, op0);
|
||||
|
||||
dest = lowpart_subreg (vmode, dest, mode);
|
||||
emit_insn (gen_rtx_SET (dest, x));
|
||||
}
|
||||
|
||||
|
|
|
@ -10806,17 +10806,18 @@
|
|||
"ix86_expand_xorsign (operands); DONE;")
|
||||
|
||||
(define_insn_and_split "@xorsign<mode>3_1"
|
||||
[(set (match_operand:MODEF 0 "register_operand" "=Yv")
|
||||
[(set (match_operand:MODEF 0 "register_operand" "=Yv,Yv")
|
||||
(unspec:MODEF
|
||||
[(match_operand:MODEF 1 "register_operand" "Yv")
|
||||
(match_operand:MODEF 2 "register_operand" "0")
|
||||
(match_operand:<ssevecmode> 3 "nonimmediate_operand" "Yvm")]
|
||||
[(match_operand:MODEF 1 "register_operand" "Yv,Yv")
|
||||
(match_operand:MODEF 2 "register_operand" "0,Yv")
|
||||
(match_operand:<ssevecmode> 3 "nonimmediate_operand" "Yvm,Yvm")]
|
||||
UNSPEC_XORSIGN))]
|
||||
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH"
|
||||
"#"
|
||||
"&& reload_completed"
|
||||
[(const_int 0)]
|
||||
"ix86_split_xorsign (operands); DONE;")
|
||||
"ix86_split_xorsign (operands); DONE;"
|
||||
[(set_attr "isa" "noavx,avx")])
|
||||
|
||||
;; One complement instructions
|
||||
|
||||
|
|
8
gcc/testsuite/gcc.target/i386/pr89984-1.c
Normal file
8
gcc/testsuite/gcc.target/i386/pr89984-1.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* { dg-do compile { target { ! ia32 } } } */
|
||||
/* { dg-options "-O2 -mno-avx -msse2" } */
|
||||
|
||||
float
|
||||
check_f_pos (float x, float y)
|
||||
{
|
||||
return x * __builtin_copysignf (1.0f, y);
|
||||
}
|
10
gcc/testsuite/gcc.target/i386/pr89984-2.c
Normal file
10
gcc/testsuite/gcc.target/i386/pr89984-2.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile { target { ! ia32 } } } */
|
||||
/* { dg-options "-O2 -mavx" } */
|
||||
|
||||
float
|
||||
check_f_pos (float x, float y)
|
||||
{
|
||||
return x * __builtin_copysignf (1.0f, y);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-not "vmovaps" } } */
|
4
gcc/testsuite/gcc.target/i386/xorsign-avx.c
Normal file
4
gcc/testsuite/gcc.target/i386/xorsign-avx.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* { dg-do run { target avx_runtime } } */
|
||||
/* { dg-options "-O2 -mavx -mfpmath=sse -ftree-vectorize" } */
|
||||
|
||||
#include "xorsign.c"
|
Loading…
Add table
Reference in a new issue