[llvm] 20683de - [X86][CodeGen] Not promote some binary ops from i16 to i32 if we have NDD variant
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 23:45:49 PDT 2024
Author: Shengchen Kan
Date: 2024-06-26T14:45:14+08:00
New Revision: 20683de70e43fa73536ac1e8ce4082604048d040
URL: https://github.com/llvm/llvm-project/commit/20683de70e43fa73536ac1e8ce4082604048d040
DIFF: https://github.com/llvm/llvm-project/commit/20683de70e43fa73536ac1e8ce4082604048d040.diff
LOG: [X86][CodeGen] Not promote some binary ops from i16 to i32 if we have NDD variant
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/apx/adc.ll
llvm/test/CodeGen/X86/apx/add.ll
llvm/test/CodeGen/X86/apx/and.ll
llvm/test/CodeGen/X86/apx/ctest.ll
llvm/test/CodeGen/X86/apx/dec.ll
llvm/test/CodeGen/X86/apx/inc.ll
llvm/test/CodeGen/X86/apx/neg.ll
llvm/test/CodeGen/X86/apx/not.ll
llvm/test/CodeGen/X86/apx/or.ll
llvm/test/CodeGen/X86/apx/sar.ll
llvm/test/CodeGen/X86/apx/sbb.ll
llvm/test/CodeGen/X86/apx/shl.ll
llvm/test/CodeGen/X86/apx/shr.ll
llvm/test/CodeGen/X86/apx/sub.ll
llvm/test/CodeGen/X86/apx/xor.ll
llvm/test/CodeGen/X86/popcnt.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index e75dfc3721ac6..b9148999ff395 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -57550,16 +57550,20 @@ bool X86TargetLowering::isTypeDesirableForOp(unsigned Opc, EVT VT) const {
case ISD::SIGN_EXTEND:
case ISD::ZERO_EXTEND:
case ISD::ANY_EXTEND:
+ case ISD::MUL:
+ return false;
case ISD::SHL:
case ISD::SRA:
case ISD::SRL:
case ISD::SUB:
case ISD::ADD:
- case ISD::MUL:
case ISD::AND:
case ISD::OR:
case ISD::XOR:
- return false;
+ // NDD instruction never has "partial register write" issue b/c it has
+ // destination register's upper bits [63:OSIZE]) zeroed even when
+ // OSIZE=8/16.
+ return Subtarget.hasNDD();
}
}
diff --git a/llvm/test/CodeGen/X86/apx/adc.ll b/llvm/test/CodeGen/X86/apx/adc.ll
index f6792ad8d227b..ec9800ddc69ae 100644
--- a/llvm/test/CodeGen/X86/apx/adc.ll
+++ b/llvm/test/CodeGen/X86/apx/adc.ll
@@ -113,9 +113,7 @@ define i16 @adc16ri8(i16 %a, i16 %x, i16 %y) nounwind {
; CHECK-LABEL: adc16ri8:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT: adcw $0, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xd7,0x00]
-; CHECK-NEXT: addl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: adcw $123, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xd7,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
%s = add i16 %a, 123
%k = icmp ugt i16 %x, %y
@@ -167,10 +165,8 @@ define i16 @adc16ri(i16 %a, i16 %x, i16 %y) nounwind {
; CHECK-LABEL: adc16ri:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT: adcw $0, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xd7,0x00]
-; CHECK-NEXT: addl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: adcw $1234, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0xd7,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
%s = add i16 %a, 1234
%k = icmp ugt i16 %x, %y
@@ -267,9 +263,7 @@ define i16 @adc16mi8(ptr %ptr, i16 %x, i16 %y) nounwind {
; CHECK-LABEL: adc16mi8:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT: adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x17,0x00]
-; CHECK-NEXT: addl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: adcw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x17,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
%a = load i16, ptr %ptr
%s = add i16 %a, 123
@@ -325,10 +319,8 @@ define i16 @adc16mi(ptr %ptr, i16 %x, i16 %y) nounwind {
; CHECK-LABEL: adc16mi:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT: adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x17,0x00]
-; CHECK-NEXT: addl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: adcw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x17,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
%a = load i16, ptr %ptr
%s = add i16 %a, 1234
@@ -447,10 +439,8 @@ define void @adc16mi_legacy(ptr %ptr, i16 %x, i16 %y) nounwind {
; CHECK-LABEL: adc16mi_legacy:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT: adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x17,0x00]
-; CHECK-NEXT: addl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: adcw $1234, (%rdi) # encoding: [0x66,0x81,0x17,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: movw %ax, (%rdi) # encoding: [0x66,0x89,0x07]
; CHECK-NEXT: retq # encoding: [0xc3]
%a = load i16, ptr %ptr
%s = add i16 %a, 1234
diff --git a/llvm/test/CodeGen/X86/apx/add.ll b/llvm/test/CodeGen/X86/apx/add.ll
index 334ceb2e6d76f..2641fd7c14141 100644
--- a/llvm/test/CodeGen/X86/apx/add.ll
+++ b/llvm/test/CodeGen/X86/apx/add.ll
@@ -20,14 +20,12 @@ entry:
define i16 @add16rr(i16 noundef %a, i16 noundef %b) {
; CHECK-LABEL: add16rr:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: addl %esi, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x01,0xf7]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: addw %si, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x01,0xf7]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: add16rr:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} addl %esi, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x01,0xf7]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} addw %si, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x01,0xf7]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%add = add i16 %a, %b
@@ -131,14 +129,12 @@ entry:
define i16 @add16ri8(i16 noundef %a) {
; CHECK-LABEL: add16ri8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: addl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xc7,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: addw $123, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xc7,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: add16ri8:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} addl $123, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x83,0xc7,0x7b]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} addw $123, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0xc7,0x7b]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%add = add i16 %a, 123
@@ -193,16 +189,14 @@ entry:
define i16 @add16ri(i16 noundef %a) {
; CHECK-LABEL: add16ri:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: addl $1234, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xc7,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: addw $1234, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0xc7,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: add16ri:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} addl $1234, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x81,0xc7,0xd2,0x04,0x00,0x00]
+; NF-NEXT: {nf} addw $1234, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0xc7,0xd2,0x04]
; NF-NEXT: # imm = 0x4D2
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%add = add i16 %a, 1234
@@ -310,16 +304,12 @@ entry:
define i16 @add16mi8(ptr %a) {
; CHECK-LABEL: add16mi8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: addl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: addw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x07,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: add16mi8:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: addl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x7b]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} addw $123, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0x07,0x7b]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
@@ -378,18 +368,14 @@ entry:
define i16 @add16mi(ptr %a) {
; CHECK-LABEL: add16mi:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: addl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: addw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x07,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: add16mi:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: addl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xd2,0x04,0x00,0x00]
+; NF-NEXT: {nf} addw $1234, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0x07,0xd2,0x04]
; NF-NEXT: # imm = 0x4D2
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
diff --git a/llvm/test/CodeGen/X86/apx/and.ll b/llvm/test/CodeGen/X86/apx/and.ll
index d902f41284e33..51858ad591605 100644
--- a/llvm/test/CodeGen/X86/apx/and.ll
+++ b/llvm/test/CodeGen/X86/apx/and.ll
@@ -133,14 +133,12 @@ entry:
define i16 @and16ri8(i16 noundef %a) {
; CHECK-LABEL: and16ri8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: andl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xe7,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: andw $123, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xe7,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: and16ri8:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} andl $123, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x83,0xe7,0x7b]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} andw $123, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0xe7,0x7b]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%and = and i16 %a, 123
@@ -195,16 +193,14 @@ entry:
define i16 @and16ri(i16 noundef %a) {
; CHECK-LABEL: and16ri:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: andl $1234, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xe7,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: andw $1234, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0xe7,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: and16ri:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} andl $1234, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x81,0xe7,0xd2,0x04,0x00,0x00]
+; NF-NEXT: {nf} andw $1234, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0xe7,0xd2,0x04]
; NF-NEXT: # imm = 0x4D2
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%and = and i16 %a, 1234
@@ -312,16 +308,12 @@ entry:
define i16 @and16mi8(ptr %a) {
; CHECK-LABEL: and16mi8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: andl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe0,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: andw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x27,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: and16mi8:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: andl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe0,0x7b]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} andw $123, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0x27,0x7b]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
@@ -382,18 +374,14 @@ entry:
define i16 @and16mi(ptr %a) {
; CHECK-LABEL: and16mi:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: andl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x25,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: andw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x27,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: and16mi:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: andl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x25,0xd2,0x04,0x00,0x00]
+; NF-NEXT: {nf} andw $1234, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0x27,0xd2,0x04]
; NF-NEXT: # imm = 0x4D2
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
@@ -469,7 +457,7 @@ define i1 @andflag8rr(i8 %a, i8 %b) {
define i1 @andflag16rr(i16 %a, i16 %b) {
; CHECK-LABEL: andflag16rr:
; CHECK: # %bb.0:
-; CHECK-NEXT: notl %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xf7,0xd6]
+; CHECK-NEXT: notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
; CHECK-NEXT: andw %ax, %di, %cx # encoding: [0x62,0xf4,0x75,0x18,0x21,0xc7]
; CHECK-NEXT: sete %al # encoding: [0x0f,0x94,0xc0]
; CHECK-NEXT: movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
@@ -478,7 +466,7 @@ define i1 @andflag16rr(i16 %a, i16 %b) {
;
; NF-LABEL: andflag16rr:
; NF: # %bb.0:
-; NF-NEXT: notl %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xf7,0xd6]
+; NF-NEXT: notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
; NF-NEXT: andw %ax, %di, %cx # encoding: [0x62,0xf4,0x75,0x18,0x21,0xc7]
; NF-NEXT: sete %al # encoding: [0x0f,0x94,0xc0]
; NF-NEXT: movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
@@ -564,7 +552,7 @@ define i1 @andflag8rm(ptr %ptr, i8 %b) {
define i1 @andflag16rm(ptr %ptr, i16 %b) {
; CHECK-LABEL: andflag16rm:
; CHECK: # %bb.0:
-; CHECK-NEXT: notl %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xf7,0xd6]
+; CHECK-NEXT: notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
; CHECK-NEXT: andw (%rdi), %ax, %cx # encoding: [0x62,0xf4,0x75,0x18,0x23,0x07]
; CHECK-NEXT: sete %al # encoding: [0x0f,0x94,0xc0]
; CHECK-NEXT: movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
@@ -573,7 +561,7 @@ define i1 @andflag16rm(ptr %ptr, i16 %b) {
;
; NF-LABEL: andflag16rm:
; NF: # %bb.0:
-; NF-NEXT: notl %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xf7,0xd6]
+; NF-NEXT: notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
; NF-NEXT: andw (%rdi), %ax, %cx # encoding: [0x62,0xf4,0x75,0x18,0x23,0x07]
; NF-NEXT: sete %al # encoding: [0x0f,0x94,0xc0]
; NF-NEXT: movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
diff --git a/llvm/test/CodeGen/X86/apx/ctest.ll b/llvm/test/CodeGen/X86/apx/ctest.ll
index 22afc39fd40c9..cef835ac918a3 100644
--- a/llvm/test/CodeGen/X86/apx/ctest.ll
+++ b/llvm/test/CodeGen/X86/apx/ctest.ll
@@ -396,9 +396,8 @@ define void @ctest16ri_zf(i16 noundef %a, i16 noundef %b) {
;
; NDD-LABEL: ctest16ri_zf:
; NDD: # %bb.0: # %entry
-; NDD-NEXT: andl $1234, %esi, %eax # imm = 0x4D2
; NDD-NEXT: testw %di, %di
-; NDD-NEXT: ctestnew {dfv=zf} %ax, %ax
+; NDD-NEXT: ctestnew {dfv=zf} $1234, %si # imm = 0x4D2
; NDD-NEXT: jne .LBB10_1
; NDD-NEXT: # %bb.2: # %if.then
; NDD-NEXT: xorl %eax, %eax
@@ -704,10 +703,8 @@ define void @ctest16mi_zf(i16 noundef %a, ptr %ptr) {
;
; NDD-LABEL: ctest16mi_zf:
; NDD: # %bb.0: # %entry
-; NDD-NEXT: movzwl (%rsi), %eax
-; NDD-NEXT: andl $1234, %eax # imm = 0x4D2
; NDD-NEXT: testw %di, %di
-; NDD-NEXT: ctestnew {dfv=zf} %ax, %ax
+; NDD-NEXT: ctestnew {dfv=zf} $1234, (%rsi) # imm = 0x4D2
; NDD-NEXT: jne .LBB18_1
; NDD-NEXT: # %bb.2: # %if.then
; NDD-NEXT: xorl %eax, %eax
@@ -746,10 +743,8 @@ define void @ctest32mi_zf(i32 noundef %a, ptr %ptr) {
;
; NDD-LABEL: ctest32mi_zf:
; NDD: # %bb.0: # %entry
-; NDD-NEXT: movzwl (%rsi), %eax
-; NDD-NEXT: andl $12345, %eax # imm = 0x3039
; NDD-NEXT: testl %edi, %edi
-; NDD-NEXT: ctestnew {dfv=zf} %ax, %ax
+; NDD-NEXT: ctestnew {dfv=zf} $12345, (%rsi) # imm = 0x3039
; NDD-NEXT: jne .LBB19_1
; NDD-NEXT: # %bb.2: # %if.then
; NDD-NEXT: xorl %eax, %eax
diff --git a/llvm/test/CodeGen/X86/apx/dec.ll b/llvm/test/CodeGen/X86/apx/dec.ll
index a18ed2ace603a..56c4533629186 100644
--- a/llvm/test/CodeGen/X86/apx/dec.ll
+++ b/llvm/test/CodeGen/X86/apx/dec.ll
@@ -20,14 +20,12 @@ entry:
define i16 @dec16r(i16 noundef %a) {
; CHECK-LABEL: dec16r:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: decl %edi, %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: decw %di, %ax
; CHECK-NEXT: retq
;
; NF-LABEL: dec16r:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} decl %edi, %eax
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} decw %di, %ax
; NF-NEXT: retq
entry:
%dec = sub i16 %a, 1
@@ -83,16 +81,12 @@ entry:
define i16 @dec16m(ptr %ptr) {
; CHECK-LABEL: dec16m:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax
-; CHECK-NEXT: decl %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: decw (%rdi), %ax
; CHECK-NEXT: retq
;
; NF-LABEL: dec16m:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax
-; NF-NEXT: decl %eax
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} decw (%rdi), %ax
; NF-NEXT: retq
entry:
%a = load i16, ptr %ptr
diff --git a/llvm/test/CodeGen/X86/apx/inc.ll b/llvm/test/CodeGen/X86/apx/inc.ll
index 8d31badb99779..cecb65261bf81 100644
--- a/llvm/test/CodeGen/X86/apx/inc.ll
+++ b/llvm/test/CodeGen/X86/apx/inc.ll
@@ -20,14 +20,12 @@ entry:
define i16 @inc16r(i16 noundef %a) {
; CHECK-LABEL: inc16r:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: incl %edi, %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: incw %di, %ax
; CHECK-NEXT: retq
;
; NF-LABEL: inc16r:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} incl %edi, %eax
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} incw %di, %ax
; NF-NEXT: retq
entry:
%inc = add i16 %a, 1
@@ -83,16 +81,12 @@ entry:
define i16 @inc16m(ptr %ptr) {
; CHECK-LABEL: inc16m:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax
-; CHECK-NEXT: incl %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: incw (%rdi), %ax
; CHECK-NEXT: retq
;
; NF-LABEL: inc16m:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax
-; NF-NEXT: incl %eax
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} incw (%rdi), %ax
; NF-NEXT: retq
entry:
%a = load i16, ptr %ptr
diff --git a/llvm/test/CodeGen/X86/apx/neg.ll b/llvm/test/CodeGen/X86/apx/neg.ll
index 5e033e33cb8b2..cf86dc609bc33 100644
--- a/llvm/test/CodeGen/X86/apx/neg.ll
+++ b/llvm/test/CodeGen/X86/apx/neg.ll
@@ -20,14 +20,12 @@ entry:
define i16 @neg16r(i16 noundef %a) {
; CHECK-LABEL: neg16r:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: negl %edi, %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: negw %di, %ax
; CHECK-NEXT: retq
;
; NF-LABEL: neg16r:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} negl %edi, %eax
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} negw %di, %ax
; NF-NEXT: retq
entry:
%neg = sub i16 0, %a
@@ -147,14 +145,12 @@ entry:
define i16 @uneg16r(i16 noundef %a) {
; CHECK-LABEL: uneg16r:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: negl %edi, %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: negw %di, %ax
; CHECK-NEXT: retq
;
; NF-LABEL: uneg16r:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} negl %edi, %eax
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} negw %di, %ax
; NF-NEXT: retq
entry:
%t = call {i16, i1} @llvm.usub.with.overflow.i16(i16 0, i16 %a)
diff --git a/llvm/test/CodeGen/X86/apx/not.ll b/llvm/test/CodeGen/X86/apx/not.ll
index 5369819d51292..f13131ece5a56 100644
--- a/llvm/test/CodeGen/X86/apx/not.ll
+++ b/llvm/test/CodeGen/X86/apx/not.ll
@@ -14,8 +14,7 @@ entry:
define i16 @not16r(i16 noundef %a) {
; CHECK-LABEL: not16r:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: notl %edi, %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: notw %di, %ax
; CHECK-NEXT: retq
entry:
%not = xor i16 %a, -1
@@ -56,9 +55,7 @@ entry:
define i16 @not16m(ptr %ptr) {
; CHECK-LABEL: not16m:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax
-; CHECK-NEXT: notl %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: notw (%rdi), %ax
; CHECK-NEXT: retq
entry:
%a = load i16, ptr %ptr
diff --git a/llvm/test/CodeGen/X86/apx/or.ll b/llvm/test/CodeGen/X86/apx/or.ll
index f7aa400714dc3..6a3db295c8c15 100644
--- a/llvm/test/CodeGen/X86/apx/or.ll
+++ b/llvm/test/CodeGen/X86/apx/or.ll
@@ -133,14 +133,12 @@ entry:
define i16 @or16ri8(i16 noundef %a) {
; CHECK-LABEL: or16ri8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: orl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xcf,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: orw $123, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xcf,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: or16ri8:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} orl $123, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x83,0xcf,0x7b]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} orw $123, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0xcf,0x7b]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%or = or i16 %a, 123
@@ -195,16 +193,14 @@ entry:
define i16 @or16ri(i16 noundef %a) {
; CHECK-LABEL: or16ri:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: orl $1234, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xcf,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: orw $1234, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0xcf,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: or16ri:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} orl $1234, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x81,0xcf,0xd2,0x04,0x00,0x00]
+; NF-NEXT: {nf} orw $1234, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0xcf,0xd2,0x04]
; NF-NEXT: # imm = 0x4D2
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%or = or i16 %a, 1234
@@ -312,16 +308,12 @@ entry:
define i16 @or16mi8(ptr %a) {
; CHECK-LABEL: or16mi8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: orl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc8,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: orw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x0f,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: or16mi8:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: orl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc8,0x7b]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} orw $123, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0x0f,0x7b]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
@@ -380,18 +372,14 @@ entry:
define i16 @or16mi(ptr %a) {
; CHECK-LABEL: or16mi:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: orl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x0d,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: orw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x0f,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: or16mi:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: orl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x0d,0xd2,0x04,0x00,0x00]
+; NF-NEXT: {nf} orw $1234, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0x0f,0xd2,0x04]
; NF-NEXT: # imm = 0x4D2
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
@@ -465,7 +453,7 @@ define i1 @orflag8rr(i8 %a, i8 %b) {
define i1 @orflag16rr(i16 %a, i16 %b) {
; CHECK-LABEL: orflag16rr:
; CHECK: # %bb.0:
-; CHECK-NEXT: notl %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xf7,0xd6]
+; CHECK-NEXT: notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
; CHECK-NEXT: orw %ax, %di, %cx # encoding: [0x62,0xf4,0x75,0x18,0x09,0xc7]
; CHECK-NEXT: sete %al # encoding: [0x0f,0x94,0xc0]
; CHECK-NEXT: movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
@@ -474,7 +462,7 @@ define i1 @orflag16rr(i16 %a, i16 %b) {
;
; NF-LABEL: orflag16rr:
; NF: # %bb.0:
-; NF-NEXT: notl %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xf7,0xd6]
+; NF-NEXT: notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
; NF-NEXT: orw %ax, %di, %cx # encoding: [0x62,0xf4,0x75,0x18,0x09,0xc7]
; NF-NEXT: sete %al # encoding: [0x0f,0x94,0xc0]
; NF-NEXT: movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
@@ -560,7 +548,7 @@ define i1 @orflag8rm(ptr %ptr, i8 %b) {
define i1 @orflag16rm(ptr %ptr, i16 %b) {
; CHECK-LABEL: orflag16rm:
; CHECK: # %bb.0:
-; CHECK-NEXT: notl %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xf7,0xd6]
+; CHECK-NEXT: notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
; CHECK-NEXT: orw (%rdi), %ax, %cx # encoding: [0x62,0xf4,0x75,0x18,0x0b,0x07]
; CHECK-NEXT: sete %al # encoding: [0x0f,0x94,0xc0]
; CHECK-NEXT: movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
@@ -569,7 +557,7 @@ define i1 @orflag16rm(ptr %ptr, i16 %b) {
;
; NF-LABEL: orflag16rm:
; NF: # %bb.0:
-; NF-NEXT: notl %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xf7,0xd6]
+; NF-NEXT: notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
; NF-NEXT: orw (%rdi), %ax, %cx # encoding: [0x62,0xf4,0x75,0x18,0x0b,0x07]
; NF-NEXT: sete %al # encoding: [0x0f,0x94,0xc0]
; NF-NEXT: movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
diff --git a/llvm/test/CodeGen/X86/apx/sar.ll b/llvm/test/CodeGen/X86/apx/sar.ll
index 6a14aa6a50563..25c067b46b9ce 100644
--- a/llvm/test/CodeGen/X86/apx/sar.ll
+++ b/llvm/test/CodeGen/X86/apx/sar.ll
@@ -15,9 +15,7 @@ entry:
define i16 @sar16m1(ptr %ptr) {
; CHECK-LABEL: sar16m1:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movswl (%rdi), %eax # encoding: [0x0f,0xbf,0x07]
-; CHECK-NEXT: shrl %eax # EVEX TO LEGACY Compression encoding: [0xd1,0xe8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: sarw (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd1,0x3f]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -78,10 +76,8 @@ define i16 @sar16mcl(ptr %ptr, i16 %cl) {
; CHECK-LABEL: sar16mcl:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movswl (%rdi), %eax # encoding: [0x0f,0xbf,0x07]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: sarl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xf8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: sarw %cl, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0x3f]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -93,10 +89,8 @@ define i16 @sar16mcl_mask(ptr %ptr, i16 %cl) {
; CHECK-LABEL: sar16mcl_mask:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movswl (%rdi), %eax # encoding: [0x0f,0xbf,0x07]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: sarl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xf8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: sarw %cl, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0x3f]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -173,9 +167,7 @@ entry:
define i16 @sar16mi(ptr %ptr) {
; CHECK-LABEL: sar16mi:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movswl (%rdi), %eax # encoding: [0x0f,0xbf,0x07]
-; CHECK-NEXT: shrl $4, %eax # EVEX TO LEGACY Compression encoding: [0xc1,0xe8,0x04]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: sarw $4, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xc1,0x3f,0x04]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -218,9 +210,7 @@ entry:
define i16 @sar16r1(i16 noundef %a) {
; CHECK-LABEL: sar16r1:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movswl %di, %eax # encoding: [0x0f,0xbf,0xc7]
-; CHECK-NEXT: shrl %eax # EVEX TO LEGACY Compression encoding: [0xd1,0xe8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: sarw %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd1,0xff]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%sar = ashr i16 %a, 1
@@ -276,10 +266,8 @@ define i16 @sar16rcl(i16 noundef %a, i16 %cl) {
; CHECK-LABEL: sar16rcl:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movswl %di, %eax # encoding: [0x0f,0xbf,0xc7]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: sarl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xf8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: sarw %cl, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0xff]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%sar = ashr i16 %a, %cl
@@ -290,10 +278,8 @@ define i16 @sar16rcl_mask(i16 noundef %a, i16 %cl) {
; CHECK-LABEL: sar16rcl_mask:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movswl %di, %eax # encoding: [0x0f,0xbf,0xc7]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: sarl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xf8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: sarw %cl, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0xff]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%shamt = and i16 %cl, 31
@@ -364,9 +350,7 @@ entry:
define i16 @sar16ri(i16 noundef %a) {
; CHECK-LABEL: sar16ri:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movswl %di, %eax # encoding: [0x0f,0xbf,0xc7]
-; CHECK-NEXT: shrl $4, %eax # EVEX TO LEGACY Compression encoding: [0xc1,0xe8,0x04]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: sarw $4, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xc1,0xff,0x04]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%sar = ashr i16 %a, 4
diff --git a/llvm/test/CodeGen/X86/apx/sbb.ll b/llvm/test/CodeGen/X86/apx/sbb.ll
index b9032f92f8b20..a67419bbd5db7 100644
--- a/llvm/test/CodeGen/X86/apx/sbb.ll
+++ b/llvm/test/CodeGen/X86/apx/sbb.ll
@@ -114,8 +114,7 @@ define i16 @sbb16ri8(i16 %a, i16 %x, i16 %y) nounwind {
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
; CHECK-NEXT: sbbw $0, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xdf,0x00]
-; CHECK-NEXT: addl $-123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x85]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: addw $-123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xc0,0x85]
; CHECK-NEXT: retq # encoding: [0xc3]
%s = sub i16 %a, 123
%k = icmp ugt i16 %x, %y
@@ -171,9 +170,8 @@ define i16 @sbb16ri(i16 %a, i16 %x, i16 %y) nounwind {
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
; CHECK-NEXT: sbbw $0, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xdf,0x00]
-; CHECK-NEXT: addl $-1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0x2e,0xfb,0xff,0xff]
+; CHECK-NEXT: addw $-1234, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x05,0x2e,0xfb]
; CHECK-NEXT: # imm = 0xFB2E
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
%s = sub i16 %a, 1234
%k = icmp ugt i16 %x, %y
@@ -273,8 +271,7 @@ define i16 @sbb16mi8(ptr %ptr, i16 %x, i16 %y) nounwind {
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
; CHECK-NEXT: sbbw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x1f,0x00]
-; CHECK-NEXT: addl $-123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x85]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: addw $-123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xc0,0x85]
; CHECK-NEXT: retq # encoding: [0xc3]
%a = load i16, ptr %ptr
%s = sub i16 %a, 123
@@ -334,9 +331,8 @@ define i16 @sbb16mi(ptr %ptr, i16 %x, i16 %y) nounwind {
; CHECK: # %bb.0:
; CHECK-NEXT: cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
; CHECK-NEXT: sbbw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x1f,0x00]
-; CHECK-NEXT: addl $-1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0x2e,0xfb,0xff,0xff]
+; CHECK-NEXT: addw $-1234, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x05,0x2e,0xfb]
; CHECK-NEXT: # imm = 0xFB2E
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
%a = load i16, ptr %ptr
%s = sub i16 %a, 1234
diff --git a/llvm/test/CodeGen/X86/apx/shl.ll b/llvm/test/CodeGen/X86/apx/shl.ll
index 35b6cb27254b2..1db01f2198929 100644
--- a/llvm/test/CodeGen/X86/apx/shl.ll
+++ b/llvm/test/CodeGen/X86/apx/shl.ll
@@ -20,14 +20,12 @@ entry:
define i16 @shl16ri(i16 noundef %a) {
; CHECK-LABEL: shl16ri:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: shll $4, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xc1,0xe7,0x04]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shlw $4, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xc1,0xe7,0x04]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shl16ri:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} shll $4, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0xc1,0xe7,0x04]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shlw $4, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xc1,0xe7,0x04]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%shl = shl i16 %a, 4
@@ -86,15 +84,13 @@ define i16 @shl16m1(ptr %ptr) {
; CHECK-LABEL: shl16m1:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: addl %eax, %eax # EVEX TO LEGACY Compression encoding: [0x01,0xc0]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: addw %ax, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x01,0xc0]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shl16m1:
; NF: # %bb.0: # %entry
; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: addl %eax, %eax # EVEX TO LEGACY Compression encoding: [0x01,0xc0]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: addw %ax, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x01,0xc0]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -183,19 +179,15 @@ define i16 @shl16mcl(ptr %ptr, i16 %cl) {
; CHECK-LABEL: shl16mcl:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: shll %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe0]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shlw %cl, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0x27]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shl16mcl:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
; NF-NEXT: # kill: def $cl killed $cl killed $ecx
-; NF-NEXT: shll %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe0]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shlw %cl, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd3,0x27]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -207,19 +199,15 @@ define i16 @shl16mcl_mask(ptr %ptr, i16 %cl) {
; CHECK-LABEL: shl16mcl_mask:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: shll %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe0]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shlw %cl, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0x27]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shl16mcl_mask:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
; NF-NEXT: # kill: def $cl killed $cl killed $ecx
-; NF-NEXT: shll %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe0]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shlw %cl, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd3,0x27]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -329,16 +317,12 @@ entry:
define i16 @shl16mi(ptr %ptr) {
; CHECK-LABEL: shl16mi:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: shll $4, %eax # EVEX TO LEGACY Compression encoding: [0xc1,0xe0,0x04]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shlw $4, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xc1,0x27,0x04]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shl16mi:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: shll $4, %eax # EVEX TO LEGACY Compression encoding: [0xc1,0xe0,0x04]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shlw $4, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xc1,0x27,0x04]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -396,14 +380,12 @@ entry:
define i16 @shl16r1(i16 noundef %a) {
; CHECK-LABEL: shl16r1:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: addl %edi, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x01,0xff]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: addw %di, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x01,0xff]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shl16r1:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} addl %edi, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x01,0xff]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} addw %di, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x01,0xff]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%shl = shl i16 %a, 1
@@ -484,16 +466,14 @@ define i16 @shl16rcl(i16 noundef %a, i16 %cl) {
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: shll %cl, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xd3,0xe7]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shlw %cl, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0xe7]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shl16rcl:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
; NF-NEXT: # kill: def $cl killed $cl killed $ecx
-; NF-NEXT: {nf} shll %cl, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0xd3,0xe7]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shlw %cl, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd3,0xe7]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%shl = shl i16 %a, %cl
@@ -505,16 +485,14 @@ define i16 @shl16rcl_mask(i16 noundef %a, i16 %cl) {
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: shll %cl, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0xd3,0xe7]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shlw %cl, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0xe7]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shl16rcl_mask:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
; NF-NEXT: # kill: def $cl killed $cl killed $ecx
-; NF-NEXT: {nf} shll %cl, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0xd3,0xe7]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shlw %cl, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd3,0xe7]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%shamt = and i16 %cl, 31
diff --git a/llvm/test/CodeGen/X86/apx/shr.ll b/llvm/test/CodeGen/X86/apx/shr.ll
index b5b91b02fedff..a63d22b30f83d 100644
--- a/llvm/test/CodeGen/X86/apx/shr.ll
+++ b/llvm/test/CodeGen/X86/apx/shr.ll
@@ -21,16 +21,12 @@ entry:
define i16 @shr16m1(ptr %ptr) {
; CHECK-LABEL: shr16m1:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: shrl %eax # EVEX TO LEGACY Compression encoding: [0xd1,0xe8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shrw (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd1,0x2f]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shr16m1:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: shrl %eax # EVEX TO LEGACY Compression encoding: [0xd1,0xe8]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shrw (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd1,0x2f]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -115,19 +111,15 @@ define i16 @shr16mcl(ptr %ptr, i16 %cl) {
; CHECK-LABEL: shr16mcl:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: shrl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shrw %cl, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0x2f]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shr16mcl:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
; NF-NEXT: # kill: def $cl killed $cl killed $ecx
-; NF-NEXT: shrl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe8]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shrw %cl, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd3,0x2f]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -139,19 +131,15 @@ define i16 @shr16mcl_mask(ptr %ptr, i16 %cl) {
; CHECK-LABEL: shr16mcl_mask:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: shrl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shrw %cl, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0x2f]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shr16mcl_mask:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
; NF-NEXT: # kill: def $cl killed $cl killed $ecx
-; NF-NEXT: shrl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe8]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shrw %cl, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd3,0x2f]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -261,16 +249,12 @@ entry:
define i16 @shr16mi(ptr %ptr) {
; CHECK-LABEL: shr16mi:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: shrl $4, %eax # EVEX TO LEGACY Compression encoding: [0xc1,0xe8,0x04]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shrw $4, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xc1,0x2f,0x04]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shr16mi:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: shrl $4, %eax # EVEX TO LEGACY Compression encoding: [0xc1,0xe8,0x04]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shrw $4, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xc1,0x2f,0x04]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%a = load i16, ptr %ptr
@@ -328,16 +312,12 @@ entry:
define i16 @shr16r1(i16 noundef %a) {
; CHECK-LABEL: shr16r1:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl %di, %eax # encoding: [0x0f,0xb7,0xc7]
-; CHECK-NEXT: shrl %eax # EVEX TO LEGACY Compression encoding: [0xd1,0xe8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shrw %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd1,0xef]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shr16r1:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl %di, %eax # encoding: [0x0f,0xb7,0xc7]
-; NF-NEXT: shrl %eax # EVEX TO LEGACY Compression encoding: [0xd1,0xe8]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shrw %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd1,0xef]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%shr = lshr i16 %a, 1
@@ -417,19 +397,15 @@ define i16 @shr16rcl(i16 noundef %a, i16 %cl) {
; CHECK-LABEL: shr16rcl:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movzwl %di, %eax # encoding: [0x0f,0xb7,0xc7]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: shrl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shrw %cl, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0xef]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shr16rcl:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; NF-NEXT: movzwl %di, %eax # encoding: [0x0f,0xb7,0xc7]
; NF-NEXT: # kill: def $cl killed $cl killed $ecx
-; NF-NEXT: shrl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe8]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shrw %cl, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd3,0xef]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%shr = lshr i16 %a, %cl
@@ -440,19 +416,15 @@ define i16 @shr16rcl_mask(i16 noundef %a, i16 %cl) {
; CHECK-LABEL: shr16rcl_mask:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; CHECK-NEXT: movzwl %di, %eax # encoding: [0x0f,0xb7,0xc7]
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
-; CHECK-NEXT: shrl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe8]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shrw %cl, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xd3,0xef]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shr16rcl_mask:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %esi, %ecx # encoding: [0x89,0xf1]
-; NF-NEXT: movzwl %di, %eax # encoding: [0x0f,0xb7,0xc7]
; NF-NEXT: # kill: def $cl killed $cl killed $ecx
-; NF-NEXT: shrl %cl, %eax # EVEX TO LEGACY Compression encoding: [0xd3,0xe8]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shrw %cl, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd3,0xef]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%shamt = and i16 %cl, 31
@@ -556,16 +528,12 @@ entry:
define i16 @shr16ri(i16 noundef %a) {
; CHECK-LABEL: shr16ri:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl %di, %eax # encoding: [0x0f,0xb7,0xc7]
-; CHECK-NEXT: shrl $4, %eax # EVEX TO LEGACY Compression encoding: [0xc1,0xe8,0x04]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: shrw $4, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xc1,0xef,0x04]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: shr16ri:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl %di, %eax # encoding: [0x0f,0xb7,0xc7]
-; NF-NEXT: shrl $4, %eax # EVEX TO LEGACY Compression encoding: [0xc1,0xe8,0x04]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} shrw $4, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xc1,0xef,0x04]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%shr = lshr i16 %a, 4
diff --git a/llvm/test/CodeGen/X86/apx/sub.ll b/llvm/test/CodeGen/X86/apx/sub.ll
index a38d09587ba91..75d705557cdf2 100644
--- a/llvm/test/CodeGen/X86/apx/sub.ll
+++ b/llvm/test/CodeGen/X86/apx/sub.ll
@@ -20,14 +20,12 @@ entry:
define i16 @sub16rr(i16 noundef %a, i16 noundef %b) {
; CHECK-LABEL: sub16rr:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: subl %esi, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x29,0xf7]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: subw %si, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x29,0xf7]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: sub16rr:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} subl %esi, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x29,0xf7]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} subw %si, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x29,0xf7]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%sub = sub i16 %a, %b
@@ -131,14 +129,12 @@ entry:
define i16 @sub16ri8(i16 noundef %a) {
; CHECK-LABEL: sub16ri8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: subl $-128, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xef,0x80]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: subw $-128, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xef,0x80]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: sub16ri8:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} subl $-128, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x83,0xef,0x80]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} subw $-128, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0xef,0x80]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%sub = sub i16 %a, -128
@@ -193,16 +189,14 @@ entry:
define i16 @sub16ri(i16 noundef %a) {
; CHECK-LABEL: sub16ri:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: addl $-1234, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xc7,0x2e,0xfb,0xff,0xff]
+; CHECK-NEXT: addw $-1234, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0xc7,0x2e,0xfb]
; CHECK-NEXT: # imm = 0xFB2E
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: sub16ri:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} addl $-1234, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x81,0xc7,0x2e,0xfb,0xff,0xff]
+; NF-NEXT: {nf} addw $-1234, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0xc7,0x2e,0xfb]
; NF-NEXT: # imm = 0xFB2E
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%sub = sub i16 %a, 1234
@@ -262,16 +256,12 @@ entry:
define i16 @sub16mr(ptr %a, i16 noundef %b) {
; CHECK-LABEL: sub16mr:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: subl %esi, %eax # EVEX TO LEGACY Compression encoding: [0x29,0xf0]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: subw %si, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x29,0x37]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: sub16mr:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: subl %esi, %eax # EVEX TO LEGACY Compression encoding: [0x29,0xf0]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} subw %si, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x29,0x37]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
@@ -314,16 +304,12 @@ entry:
define i16 @sub16mi8(ptr %a) {
; CHECK-LABEL: sub16mi8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: subl $-128, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe8,0x80]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: subw $-128, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x2f,0x80]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: sub16mi8:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: subl $-128, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe8,0x80]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} subw $-128, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0x2f,0x80]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
@@ -382,18 +368,14 @@ entry:
define i16 @sub16mi(ptr %a) {
; CHECK-LABEL: sub16mi:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: addl $-1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0x2e,0xfb,0xff,0xff]
+; CHECK-NEXT: addw $-1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x07,0x2e,0xfb]
; CHECK-NEXT: # imm = 0xFB2E
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: sub16mi:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: addl $-1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0x2e,0xfb,0xff,0xff]
+; NF-NEXT: {nf} addw $-1234, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0x07,0x2e,0xfb]
; NF-NEXT: # imm = 0xFB2E
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
diff --git a/llvm/test/CodeGen/X86/apx/xor.ll b/llvm/test/CodeGen/X86/apx/xor.ll
index 6a6b699a922db..3426f9cc92ce7 100644
--- a/llvm/test/CodeGen/X86/apx/xor.ll
+++ b/llvm/test/CodeGen/X86/apx/xor.ll
@@ -133,14 +133,12 @@ entry:
define i16 @xor16ri8(i16 noundef %a) {
; CHECK-LABEL: xor16ri8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: xorl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xf7,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: xorw $123, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xf7,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: xor16ri8:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} xorl $123, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x83,0xf7,0x7b]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} xorw $123, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0xf7,0x7b]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%xor = xor i16 %a, 123
@@ -195,16 +193,14 @@ entry:
define i16 @xor16ri(i16 noundef %a) {
; CHECK-LABEL: xor16ri:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: xorl $1234, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xf7,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: xorw $1234, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0xf7,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: xor16ri:
; NF: # %bb.0: # %entry
-; NF-NEXT: {nf} xorl $1234, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0x81,0xf7,0xd2,0x04,0x00,0x00]
+; NF-NEXT: {nf} xorw $1234, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0xf7,0xd2,0x04]
; NF-NEXT: # imm = 0x4D2
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%xor = xor i16 %a, 1234
@@ -312,16 +308,12 @@ entry:
define i16 @xor16mi8(ptr %a) {
; CHECK-LABEL: xor16mi8:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: xorl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xf0,0x7b]
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: xorw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x37,0x7b]
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: xor16mi8:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: xorl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xf0,0x7b]
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
+; NF-NEXT: {nf} xorw $123, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x83,0x37,0x7b]
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
@@ -380,18 +372,14 @@ entry:
define i16 @xor16mi(ptr %a) {
; CHECK-LABEL: xor16mi:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; CHECK-NEXT: xorl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x35,0xd2,0x04,0x00,0x00]
+; CHECK-NEXT: xorw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x37,0xd2,0x04]
; CHECK-NEXT: # imm = 0x4D2
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq # encoding: [0xc3]
;
; NF-LABEL: xor16mi:
; NF: # %bb.0: # %entry
-; NF-NEXT: movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; NF-NEXT: xorl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x35,0xd2,0x04,0x00,0x00]
+; NF-NEXT: {nf} xorw $1234, (%rdi), %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0x81,0x37,0xd2,0x04]
; NF-NEXT: # imm = 0x4D2
-; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq # encoding: [0xc3]
entry:
%t= load i16, ptr %a
diff --git a/llvm/test/CodeGen/X86/popcnt.ll b/llvm/test/CodeGen/X86/popcnt.ll
index 37c7b051de7b1..13fa639dc63be 100644
--- a/llvm/test/CodeGen/X86/popcnt.ll
+++ b/llvm/test/CodeGen/X86/popcnt.ll
@@ -109,18 +109,18 @@ define i16 @cnt16(i16 %x) nounwind readnone {
;
; X64-NDD-LABEL: cnt16:
; X64-NDD: # %bb.0:
-; X64-NDD-NEXT: shrl %edi, %eax
-; X64-NDD-NEXT: andl $21845, %eax # imm = 0x5555
-; X64-NDD-NEXT: subl %eax, %edi, %eax
-; X64-NDD-NEXT: andl $13107, %eax, %ecx # imm = 0x3333
-; X64-NDD-NEXT: shrl $2, %eax
-; X64-NDD-NEXT: andl $13107, %eax # imm = 0x3333
-; X64-NDD-NEXT: addl %ecx, %eax
-; X64-NDD-NEXT: shrl $4, %eax, %ecx
-; X64-NDD-NEXT: addl %ecx, %eax
-; X64-NDD-NEXT: andl $3855, %eax # imm = 0xF0F
-; X64-NDD-NEXT: shrl $8, %eax, %ecx
-; X64-NDD-NEXT: addl %ecx, %eax
+; X64-NDD-NEXT: shrw %di, %ax
+; X64-NDD-NEXT: andw $21845, %ax # imm = 0x5555
+; X64-NDD-NEXT: subw %ax, %di, %ax
+; X64-NDD-NEXT: andw $13107, %ax, %cx # imm = 0x3333
+; X64-NDD-NEXT: shrw $2, %ax
+; X64-NDD-NEXT: andw $13107, %ax # imm = 0x3333
+; X64-NDD-NEXT: addw %cx, %ax
+; X64-NDD-NEXT: shrw $4, %ax, %cx
+; X64-NDD-NEXT: addw %cx, %ax
+; X64-NDD-NEXT: andw $3855, %ax # imm = 0xF0F
+; X64-NDD-NEXT: movzbl %ah, %ecx
+; X64-NDD-NEXT: addw %cx, %ax
; X64-NDD-NEXT: movzbl %al, %eax
; X64-NDD-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NDD-NEXT: retq
@@ -1812,19 +1812,20 @@ define i32 @popcount_i16_zext(i16 zeroext %x) {
;
; X64-NDD-LABEL: popcount_i16_zext:
; X64-NDD: # %bb.0:
-; X64-NDD-NEXT: shrl %edi, %eax
-; X64-NDD-NEXT: andl $21845, %eax # imm = 0x5555
-; X64-NDD-NEXT: subl %eax, %edi, %eax
-; X64-NDD-NEXT: andl $13107, %eax, %ecx # imm = 0x3333
-; X64-NDD-NEXT: shrl $2, %eax
-; X64-NDD-NEXT: andl $13107, %eax # imm = 0x3333
-; X64-NDD-NEXT: addl %ecx, %eax
-; X64-NDD-NEXT: shrl $4, %eax, %ecx
-; X64-NDD-NEXT: addl %ecx, %eax
-; X64-NDD-NEXT: andl $3855, %eax # imm = 0xF0F
-; X64-NDD-NEXT: shrl $8, %eax, %ecx
-; X64-NDD-NEXT: addl %ecx, %eax
+; X64-NDD-NEXT: shrw %di, %ax
+; X64-NDD-NEXT: andw $21845, %ax # imm = 0x5555
+; X64-NDD-NEXT: subw %ax, %di, %ax
+; X64-NDD-NEXT: andw $13107, %ax, %cx # imm = 0x3333
+; X64-NDD-NEXT: shrw $2, %ax
+; X64-NDD-NEXT: andw $13107, %ax # imm = 0x3333
+; X64-NDD-NEXT: addw %cx, %ax
+; X64-NDD-NEXT: shrw $4, %ax, %cx
+; X64-NDD-NEXT: addw %cx, %ax
+; X64-NDD-NEXT: andw $3855, %ax # imm = 0xF0F
+; X64-NDD-NEXT: movzbl %ah, %ecx
+; X64-NDD-NEXT: addw %cx, %ax
; X64-NDD-NEXT: movzbl %al, %eax
+; X64-NDD-NEXT: movzwl %ax, %eax
; X64-NDD-NEXT: retq
%cnt = tail call i16 @llvm.ctpop.i16(i16 %x)
%z = zext i16 %cnt to i32
More information about the llvm-commits
mailing list