[PATCH] D73607: [X86] Custom lower ISD::FROUND with SSE4.1 to avoid a libcall.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 06:54:15 PST 2020


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:20460
 
+static SDValue LowerFROUND(SDValue Op, SelectionDAG &DAG) {
+  SDValue N0 = Op.getOperand(0);
----------------
Include at least part of the text from this patch description as a block comment for this function, so:

```
/// ISD::FROUND is defined to round to nearest with ties rounding
/// away from 0. This mode isn't supported in hardware on X86.
/// But as long as we aren't compiling with trapping math, we can
/// emulate this with floor(X + copysign(nextafter(0.5, 0.0), X)).
/// ...
```


================
Comment at: llvm/test/CodeGen/X86/vec_round.ll:9
 ; Function Attrs: nounwind uwtable
 define void @test() {
 ; CHECK-LABEL: test:
----------------
This test/file was added with:
rL188048
...to show we wouldn't crash?
But it doesn't add value now that we have more thorough tests. I'd delete it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73607/new/

https://reviews.llvm.org/D73607





More information about the llvm-commits mailing list