Replace the clang builtins and LLVM intrinsics for {f32x4,f64x2}.{pmin,pmax}
with standard codegen patterns. Since wasm_simd128.h uses an integer vector as
the standard single vector type, the IR for the pmin and pmax intrinsic
functions contains bitcasts that would not be there otherwise. Add extra codegen
patterns that can still select the pmin and pmax instructions in the presence of
these bitcasts.
Details
- Reviewers
aheejin dschuff - Commits
- rG85157c007903: [WebAssembly] Codegen for pmin and pmax
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td | ||
---|---|---|
1141 | Sorry I asked this in person yesterday, but I don't think I quiet got it; why is this only for the ordered comparison? And does pseudo-min/max mean non-NaN-propagating? | |
1145–1149 | Is it OK to change the return type? The source pattern's return type is an int vector but the resulting instruction's type is a float vector. |
llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td | ||
---|---|---|
1141 | pseudo-min is defined as b < a ? b : a and pseudo-max is defined as a < b ? b : a. Both of these definitions use < as the float comparison operator, which for WebAssembly means OLT. For both pseudo-min and pseudo-max, if a or b is NaN, the comparison will be false and the result will be a. So when a is NaN but b is not, these instructions are NaN-propagating. But when b is NaN and a is not, these instructions are not NaN-propagating. In contrast, the normal min and max operations propagate NaNs in either operand position. | |
1145–1149 | Yes, this is the final step of DAG selection and we are lowering the SDNodes to TargetSDNodes here, so typing no longer applies. |
Sorry I asked this in person yesterday, but I don't think I quiet got it; why is this only for the ordered comparison? And does pseudo-min/max mean non-NaN-propagating?