Skip to content

Commit a3b7b2d

Browse files
authored
[X86][CodeGen] Not compress EVEX into VEX when R16-R31 is used (#73604)
b/c VEX prefix can not encode R16-R31.
1 parent 00f9946 commit a3b7b2d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

llvm/lib/Target/X86/X86EvexToVex.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ static bool usesExtendedRegister(const MachineInstr &MI) {
125125
if (Reg >= X86::YMM16 && Reg <= X86::YMM31)
126126
return true;
127127

128+
// Check for GPR with indexes between 16 - 31.
129+
if (X86II::isApxExtendedReg(Reg))
130+
return true;
131+
128132
return false;
129133
};
130134

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; Check EVEX is not compressed into VEX when egpr is used.
2+
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+egpr -show-mc-encoding | FileCheck %s
3+
4+
define void @test_x86_vcvtps2ph_256_m(ptr nocapture %d, <8 x float> %a) nounwind {
5+
; CHECK: vcvtps2ph $3, %ymm0, (%r16) # encoding: [0x62,0xfb,0x7d,0x28,0x1d,0x00,0x03]
6+
entry:
7+
%0 = load i32, ptr %d, align 4
8+
call void asm sideeffect "", "~{eax},~{ebx},~{ecx},~{edx},~{edi},~{esi},~{ebp},~{esp},~{r8d},~{r9d},~{r10d},~{r11d},~{r12d},~{r13d},~{r14d},~{r15d}"()
9+
%1 = tail call <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float> %a, i32 3)
10+
store <8 x i16> %1, ptr %d, align 16
11+
ret void
12+
}
13+
14+
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readonly

0 commit comments

Comments
 (0)