Skip to content

Commit 22f3976

Browse files
!fixup update affected patterns w/ explicit cast, update calling conventions
1 parent 7f2a112 commit 22f3976

File tree

5 files changed

+70
-67
lines changed

5 files changed

+70
-67
lines changed

llvm/lib/Target/X86/X86CallingConv.td

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ def RetCC_X86_32_VectorCall : CallingConv<[
364364
def RetCC_X86_64_C : CallingConv<[
365365
// The X86-64 calling convention always returns FP values in XMM0.
366366
CCIfType<[f16], CCAssignToReg<[XMM0, XMM1]>>,
367+
CCIfType<[bf16], CCAssignToReg<[XMM0, XMM1]>>,
367368
CCIfType<[f32], CCAssignToReg<[XMM0, XMM1]>>,
368369
CCIfType<[f64], CCAssignToReg<[XMM0, XMM1]>>,
369370
CCIfType<[f128], CCAssignToReg<[XMM0, XMM1]>>,
@@ -569,6 +570,10 @@ def CC_X86_64_C : CallingConv<[
569570
CCIfSubtarget<"hasSSE1()",
570571
CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>,
571572

573+
// The first 8 128-bits bf16 arguments are passed in XMM registers (part of AVX-512_BF16).
574+
CCIfType<[bf16], CCIfSubtarget<"hasAVX512()",
575+
CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>,
576+
572577
// The first 8 256-bit vector arguments are passed in YMM registers, unless
573578
// this is a vararg function.
574579
// FIXME: This isn't precisely correct; the x86-64 ABI document says that
@@ -586,7 +591,7 @@ def CC_X86_64_C : CallingConv<[
586591

587592
// Integer/FP values get stored in stack slots that are 8 bytes in size and
588593
// 8-byte aligned if there are no more registers to hold them.
589-
CCIfType<[i32, i64, f16, f32, f64], CCAssignToStack<8, 8>>,
594+
CCIfType<[i32, i64, bf16, f16, f32, f64], CCAssignToStack<8, 8>>,
590595

591596
// Long doubles get stack slots whose size and alignment depends on the
592597
// subtarget.
@@ -649,7 +654,7 @@ def CC_X86_Win64_C : CallingConv<[
649654
CCIfType<[f64], CCIfNotSubtarget<"hasSSE1()", CCBitConvertToType<i64>>>,
650655

651656
// The first 4 FP/Vector arguments are passed in XMM registers.
652-
CCIfType<[f16, f32, f64],
657+
CCIfType<[bf16, f16, f32, f64],
653658
CCAssignToRegWithShadow<[XMM0, XMM1, XMM2, XMM3],
654659
[RCX , RDX , R8 , R9 ]>>,
655660

@@ -672,7 +677,7 @@ def CC_X86_Win64_C : CallingConv<[
672677

673678
// Integer/FP values get stored in stack slots that are 8 bytes in size and
674679
// 8-byte aligned if there are no more registers to hold them.
675-
CCIfType<[i8, i16, i32, i64, f16, f32, f64], CCAssignToStack<8, 8>>
680+
CCIfType<[i8, i16, i32, i64, bf16, f16, f32, f64], CCAssignToStack<8, 8>>
676681
]>;
677682

678683
def CC_X86_Win64_VectorCall : CallingConv<[

llvm/lib/Target/X86/X86InstrAVX10.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ multiclass avx10_minmax_packed<string OpStr, AVX512VLVectorVTInfo VTI, SDNode Op
103103
}
104104

105105
multiclass avx10_minmax_scalar<string OpStr, X86VectorVTInfo _, SDNode OpNode,
106-
SDNode OpNodeSAE> {
106+
SDNode OpNodeSAE, ValueType CT> {
107107
let ExeDomain = _.ExeDomain, Predicates = [HasAVX10_2] in {
108108
let mayRaiseFPException = 1 in {
109109
let isCodeGenOnly = 1 in {
110110
def rri : AVX512Ii8<0x53, MRMSrcReg, (outs _.FRC:$dst),
111111
(ins _.FRC:$src1, _.FRC:$src2, i32u8imm:$src3),
112112
!strconcat(OpStr, "\t{$src3, $src2, $src1|$src1, $src2, $src3}"),
113-
[(set _.FRC:$dst, (OpNode _.FRC:$src1, _.FRC:$src2, (i32 timm:$src3)))]>,
113+
[(set _.FRC:$dst, (OpNode (CT _.FRC:$src1), (CT _.FRC:$src2), (i32 timm:$src3)))]>,
114114
Sched<[WriteFMAX]>;
115115

116116
def rmi : AVX512Ii8<0x53, MRMSrcMem, (outs _.FRC:$dst),
@@ -165,11 +165,11 @@ defm VMINMAXPS : avx10_minmax_packed<"vminmaxps", avx512vl_f32_info, X86vminmax>
165165
avx10_minmax_packed_sae<"vminmaxps", avx512vl_f32_info, X86vminmaxSae>,
166166
AVX512PDIi8Base, TA, EVEX_CD8<32, CD8VF>;
167167

168-
defm VMINMAXSD : avx10_minmax_scalar<"vminmaxsd", v2f64x_info, X86vminmaxs, X86vminmaxsSae>,
168+
defm VMINMAXSD : avx10_minmax_scalar<"vminmaxsd", v2f64x_info, X86vminmaxs, X86vminmaxsSae, f64>,
169169
AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<64, CD8VT1>, REX_W;
170-
defm VMINMAXSH : avx10_minmax_scalar<"vminmaxsh", v8f16x_info, X86vminmaxs, X86vminmaxsSae>,
170+
defm VMINMAXSH : avx10_minmax_scalar<"vminmaxsh", v8f16x_info, X86vminmaxs, X86vminmaxsSae, f16>,
171171
AVX512PSIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<16, CD8VT1>, TA;
172-
defm VMINMAXSS : avx10_minmax_scalar<"vminmaxss", v4f32x_info, X86vminmaxs, X86vminmaxsSae>,
172+
defm VMINMAXSS : avx10_minmax_scalar<"vminmaxss", v4f32x_info, X86vminmaxs, X86vminmaxsSae, f32>,
173173
AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<32, CD8VT1>;
174174

175175
//-------------------------------------------------

0 commit comments

Comments
 (0)