Skip to content

Commit d2528c0

Browse files
authored
[DAG] getOperationAction - always return Custom action for target opcodes (#95401)
The target must be responsible for any expansion that needs to be performed for extended types etc. Fixes #95274
1 parent 28d6aa9 commit d2528c0

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,11 +1255,12 @@ class TargetLoweringBase {
12551255
/// be promoted to a larger size, needs to be expanded to some other code
12561256
/// sequence, or the target has a custom expander for it.
12571257
LegalizeAction getOperationAction(unsigned Op, EVT VT) const {
1258-
if (VT.isExtended()) return Expand;
12591258
// If a target-specific SDNode requires legalization, require the target
12601259
// to provide custom legalization for it.
12611260
if (Op >= std::size(OpActions[0]))
12621261
return Custom;
1262+
if (VT.isExtended())
1263+
return Expand;
12631264
return OpActions[(unsigned)VT.getSimpleVT().SimpleTy][Op];
12641265
}
12651266

llvm/test/CodeGen/X86/pr95274.ll

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc < %s -mtriple=x86_64-- -mcpu=skylake-avx512 | FileCheck %s
3+
4+
define void @PR95274(ptr %p0) nounwind {
5+
; CHECK-LABEL: PR95274:
6+
; CHECK: # %bb.0:
7+
; CHECK-NEXT: vcvtps2ph $4, %zmm0, %ymm0
8+
; CHECK-NEXT: vinsertf64x4 $1, %ymm0, %zmm0, %zmm0
9+
; CHECK-NEXT: vmovups %zmm0, 1984(%rdi)
10+
; CHECK-NEXT: vmovups %zmm0, 1920(%rdi)
11+
; CHECK-NEXT: vmovups %zmm0, 1856(%rdi)
12+
; CHECK-NEXT: vmovups %zmm0, 1792(%rdi)
13+
; CHECK-NEXT: vmovups %zmm0, 1728(%rdi)
14+
; CHECK-NEXT: vmovups %zmm0, 1664(%rdi)
15+
; CHECK-NEXT: vmovups %zmm0, 1600(%rdi)
16+
; CHECK-NEXT: vmovups %zmm0, 1536(%rdi)
17+
; CHECK-NEXT: vmovups %zmm0, 1472(%rdi)
18+
; CHECK-NEXT: vmovups %zmm0, 1408(%rdi)
19+
; CHECK-NEXT: vmovups %zmm0, 1344(%rdi)
20+
; CHECK-NEXT: vmovups %zmm0, 1280(%rdi)
21+
; CHECK-NEXT: vmovups %zmm0, 1216(%rdi)
22+
; CHECK-NEXT: vmovups %zmm0, 1152(%rdi)
23+
; CHECK-NEXT: vmovups %zmm0, 1088(%rdi)
24+
; CHECK-NEXT: vmovups %zmm0, 1024(%rdi)
25+
; CHECK-NEXT: vmovups %zmm0, 960(%rdi)
26+
; CHECK-NEXT: vmovups %zmm0, 896(%rdi)
27+
; CHECK-NEXT: vmovups %zmm0, 832(%rdi)
28+
; CHECK-NEXT: vmovups %zmm0, 768(%rdi)
29+
; CHECK-NEXT: vmovups %zmm0, 704(%rdi)
30+
; CHECK-NEXT: vmovups %zmm0, 640(%rdi)
31+
; CHECK-NEXT: vmovups %zmm0, 576(%rdi)
32+
; CHECK-NEXT: vmovups %zmm0, 512(%rdi)
33+
; CHECK-NEXT: vmovups %zmm0, 448(%rdi)
34+
; CHECK-NEXT: vmovups %zmm0, 384(%rdi)
35+
; CHECK-NEXT: vmovups %zmm0, 320(%rdi)
36+
; CHECK-NEXT: vmovups %zmm0, 256(%rdi)
37+
; CHECK-NEXT: vmovups %zmm0, 192(%rdi)
38+
; CHECK-NEXT: vmovups %zmm0, 128(%rdi)
39+
; CHECK-NEXT: vmovups %zmm0, 64(%rdi)
40+
; CHECK-NEXT: vmovups %zmm0, (%rdi)
41+
; CHECK-NEXT: vzeroupper
42+
; CHECK-NEXT: retq
43+
%load = load <1024 x float>, ptr %p0, align 2
44+
%trunc = fptrunc <1024 x float> poison to <1024 x half>
45+
store <1024 x half> %trunc, ptr %p0, align 2
46+
ret void
47+
}

0 commit comments

Comments
 (0)