diff options
author | hongtao.liu <hongtao.liu@intel.com> | 2025-04-17 09:07:55 +0200 |
---|---|---|
committer | liuhongt <hongtao.liu@intel.com> | 2025-04-20 23:46:01 -0700 |
commit | e1098c7b08d9e6018f60dae7a14c5ad621618223 (patch) | |
tree | 5569c1160a21ca314a0494c69ecc02298de39b31 /gcc/testsuite | |
parent | afff07608093912b9b169a39a7b3aee4e3739d77 (diff) | |
download | gcc-e1098c7b08d9e6018f60dae7a14c5ad621618223.zip gcc-e1098c7b08d9e6018f60dae7a14c5ad621618223.tar.gz gcc-e1098c7b08d9e6018f60dae7a14c5ad621618223.tar.bz2 |
Generate 2 FMA instructions in ix86_expand_swdivsf.
When FMA is available, N-R step can be rewritten with
a / b = (a - (rcp(b) * a * b)) * rcp(b) + rcp(b) * a
which have 2 fma generated.
gcc/ChangeLog:
* config/i386/i386-expand.cc (ix86_emit_swdivsf): Generate 2
FMA instructions when TARGET_FMA.
gcc/testsuite/ChangeLog:
* gcc.target/i386/recip-vec-divf-fma.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/recip-vec-divf-fma.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/recip-vec-divf-fma.c b/gcc/testsuite/gcc.target/i386/recip-vec-divf-fma.c new file mode 100644 index 0000000..ad9e07b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/recip-vec-divf-fma.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast -mfma -mavx2" } */ +/* { dg-final { scan-assembler-times {(?n)vfn?m(add|sub)[1-3]*ps} 2 } } */ + +typedef float v4sf __attribute__((vector_size(16))); +/* (a - (rcp(b) * a * b)) * rcp(b) + rcp(b) * a */ + +v4sf +foo (v4sf a, v4sf b) +{ + return a / b; +} |