[PATCH] D140381: [PowerPC] Use Power9 test data class instruction to lower IS_FPCLASS

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 01:25:39 PDT 2023


qiucf added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:11010
+                                SelectionDAG &DAG,
+                                const PPCSubtarget &Subtarget) {
+  assert(Mask <= fcAllFlags && "Invalid fp_class flags!");
----------------
shchenz wrote:
> Should we check `isKnownNeverNaN()` or `isKnownNeverZeroFloat()` first before we really compute the class? (we may need to add `isKnownNeverInfinity()` and  `isKnownNeverSubnormal()`). With these functions, we can handle some compile-time class. For example, the `Op` is a fp constant.
I think they were already handled in constant folding/earlycse before ISel. Following code still produces folded result after this patch on pwr9:

```
define zeroext i1 @fpclass() {
entry:
  %x = call i1 @llvm.is.fpclass.f64(double 0.0, i32 64)
  ret i1 %x
}
declare i1 @llvm.is.fpclass.f64(double, i32)
```

SystemZ implementation does also not include constant folding.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140381



More information about the llvm-commits mailing list