[PATCH] D78527: [llvm] [X86] Fixed type bug in vselect for AVX masked load
Aart Bik via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 20 17:55:13 PDT 2020
aartbik created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
aartbik added reviewers: nicolasvasilache, mehdi_amini, craig.topper.
Bugzilla issue 45563
https://bugs.llvm.org/show_bug.cgi?id=45563
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78527
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/avx-bug-45563.ll
Index: llvm/test/CodeGen/X86/avx-bug-45563.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/avx-bug-45563.ll
@@ -0,0 +1,21 @@
+; RUN: llc < %s -debug-only=isel -O3 -mattr=avx 2>&1 | FileCheck %s
+
+; Bug 45563:
+; The LowerMLOAD() method AVX masked load branch should
+; use the operand vector type rather than the mask type.
+; Given, for example:
+; v4f64,ch = masked_load ..
+; The select should be:
+; v4f64 = vselect ..
+; instead of:
+; v4i64 = vselect ..
+
+define <16 x double> @bug45563(<16 x double>* %addr, <16 x double> %dst, <16 x i64> %e, <16 x i64> %f) {
+; CHECK-LABEL: bug45563:
+; CHECK: v4f64 = vselect
+ %mask = icmp slt <16 x i64> %e, %f
+ %res = call <16 x double> @llvm.masked.load.v16f64.p0v16f64(<16 x double>* %addr, i32 4, <16 x i1>%mask, <16 x double> %dst)
+ ret <16 x double> %res
+}
+
+declare <16 x double> @llvm.masked.load.v16f64.p0v16f64(<16 x double>* %addr, i32 %align, <16 x i1> %mask, <16 x double> %dst)
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -28757,8 +28757,7 @@
N->getMemOperand(), N->getAddressingMode(), N->getExtensionType(),
N->isExpandingLoad());
// Emit a blend.
- SDValue Select = DAG.getNode(ISD::VSELECT, dl, MaskVT, Mask, NewLoad,
- PassThru);
+ SDValue Select = DAG.getNode(ISD::VSELECT, dl, VT, Mask, NewLoad, PassThru);
return DAG.getMergeValues({ Select, NewLoad.getValue(1) }, dl);
}
@@ -28794,10 +28793,10 @@
PassThru, N->getMemoryVT(), N->getMemOperand(), N->getAddressingMode(),
N->getExtensionType(), N->isExpandingLoad());
- SDValue Exract = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT,
- NewLoad.getValue(0),
- DAG.getIntPtrConstant(0, dl));
- SDValue RetOps[] = {Exract, NewLoad.getValue(1)};
+ SDValue Extract =
+ DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT, NewLoad.getValue(0),
+ DAG.getIntPtrConstant(0, dl));
+ SDValue RetOps[] = {Extract, NewLoad.getValue(1)};
return DAG.getMergeValues(RetOps, dl);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78527.258877.patch
Type: text/x-patch
Size: 2294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200421/88e7b9bf/attachment.bin>
More information about the llvm-commits
mailing list