[llvm] [X86][BF16] Improve vectorization of BF16 (PR #88486)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu May 2 02:18:44 PDT 2024
================
@@ -56517,17 +56501,40 @@ static SDValue combineFP16_TO_FP(SDNode *N, SelectionDAG &DAG,
static SDValue combineFP_EXTEND(SDNode *N, SelectionDAG &DAG,
const X86Subtarget &Subtarget) {
+ EVT VT = N->getValueType(0);
+ bool IsStrict = N->isStrictFPOpcode();
+ SDValue Src = N->getOperand(IsStrict ? 1 : 0);
+ EVT SrcVT = Src.getValueType();
+
+ SDLoc dl(N);
+ if (SrcVT.getScalarType() == MVT::bf16) {
+ if (!IsStrict && Src.getOpcode() == ISD::FP_ROUND &&
+ Src.getOperand(0).getValueType() == VT)
----------------
phoebewang wrote:
> what mechanism would you recommend for forcing this optimization to not fire for a particular pair of round and extend operations?
After https://github.com/llvm/llvm-project/pull/90836 landed, you can use `__arithmetic_fence` to achieve this, e.g., https://godbolt.org/z/vYr1z3h71
https://github.com/llvm/llvm-project/pull/88486
More information about the llvm-commits
mailing list