[PATCH] D159084: InstCombine: Fold is.fpclass(x, fcInf) to fabs+fcmp
Lu Weining via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 30 02:47:38 PDT 2023
SixWeining added subscribers: wangleiat, SixWeining.
SixWeining added a comment.
If ISD::IS_FPCLASS is legal or custom on some targets, do we still need the transform?
For example on riscv64,
// test.c
_Bool check_isfpclass_inf(float x) {
return __builtin_isfpclass(x, 516);
}
`clang -S -O2 test.c --target=riscv64 -march=rv64g -o -`
Before this change, `fclass.s` is generated:
fclass.s a0, fa0
andi a0, a0, 129
snez a0, a0
ret
After this change, one more insn is generated:
fabs.s fa5, fa0
lui a0, 522240
fmv.w.x fa4, a0
feq.s a0, fa5, fa4
ret
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159084/new/
https://reviews.llvm.org/D159084
More information about the llvm-commits
mailing list