[PATCH] D129154: Use TuningFastScalarFSQRT for default X86 tuning

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 10:54:25 PDT 2022


andrew.w.kaylor created this revision.
andrew.w.kaylor added reviewers: pengfei, spatel, craig.topper, lebedev.ri, andreadb, RKSimon.
Herald added subscribers: jsji, StephenFan, hiraditya.
Herald added a project: All.
andrew.w.kaylor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When the "tune-cpu" attribute is not set or is set to "x86-64", we currently use an approximation sequence (when permitted) rather than the sqrtss instruction. Since this instruction is available with the default x86-64 ISA and is more accurate, it is better to assume fast sqrt by default, as we do with "tune-cpu"="generic".

The clang front end sets "tune-cpu"="generic" if no tuning or target processor is specifically requested, but other front ends that set "target-cpu"="x86-64" will get the "x86-64" tuning, which is different from "generic".

I've also started a discussion of this here: https://discourse.llvm.org/t/fast-scalar-fsqrt-tuning-in-x86/63605


https://reviews.llvm.org/D129154

Files:
  llvm/lib/Target/X86/X86.td
  llvm/test/CodeGen/X86/pow.ll
  llvm/test/CodeGen/X86/sqrt-fastmath-tune.ll
  llvm/test/CodeGen/X86/sqrt-fastmath-tunecpu-attr.ll
  llvm/test/CodeGen/X86/sqrt-fastmath.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129154.442350.patch
Type: text/x-patch
Size: 20036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220705/03e10fa3/attachment.bin>


More information about the llvm-commits mailing list