-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[X86][CodeGen] Add missing patterns for APX NDD instructions about en…
…coding trick
- Loading branch information
Showing
2 changed files
with
76 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,31 +89,31 @@ entry: | |
define i16 @sub16ri8(i16 noundef %a) { | ||
; CHECK-LABEL: sub16ri8: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: addl $-123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xc7,0x85] | ||
; 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: retq # encoding: [0xc3] | ||
entry: | ||
%sub = sub i16 %a, 123 | ||
%sub = sub i16 %a, -128 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
KanRobert
Author
Contributor
|
||
ret i16 %sub | ||
} | ||
|
||
define i32 @sub32ri8(i32 noundef %a) { | ||
; CHECK-LABEL: sub32ri8: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: addl $-123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xc7,0x85] | ||
; CHECK-NEXT: subl $-128, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xef,0x80] | ||
; CHECK-NEXT: retq # encoding: [0xc3] | ||
entry: | ||
%sub = sub i32 %a, 123 | ||
%sub = sub i32 %a, -128 | ||
ret i32 %sub | ||
} | ||
|
||
define i64 @sub64ri8(i64 noundef %a) { | ||
; CHECK-LABEL: sub64ri8: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: addq $-123, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xc7,0x85] | ||
; CHECK-NEXT: subq $-128, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xef,0x80] | ||
; CHECK-NEXT: retq # encoding: [0xc3] | ||
entry: | ||
%sub = sub i64 %a, 123 | ||
%sub = sub i64 %a, -128 | ||
ret i64 %sub | ||
} | ||
|
||
|
@@ -153,11 +153,11 @@ entry: | |
define i64 @sub64ri(i64 noundef %a) { | ||
; CHECK-LABEL: sub64ri: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: addq $-123456, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xc7,0xc0,0x1d,0xfe,0xff] | ||
; CHECK-NEXT: # imm = 0xFFFE1DC0 | ||
; CHECK-NEXT: subq $-2147483648, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xef,0x00,0x00,0x00,0x80] | ||
; CHECK-NEXT: # imm = 0x80000000 | ||
; CHECK-NEXT: retq # encoding: [0xc3] | ||
entry: | ||
%sub = sub i64 %a, 123456 | ||
%sub = sub i64 %a, -2147483648 | ||
ret i64 %sub | ||
} | ||
|
||
|
@@ -211,34 +211,34 @@ define i16 @sub16mi8(ptr %a) { | |
; CHECK-LABEL: sub16mi8: | ||
; 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,0x85] | ||
; CHECK-NEXT: subl $-128, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe8,0x80] | ||
; CHECK-NEXT: # kill: def $ax killed $ax killed $eax | ||
; CHECK-NEXT: retq # encoding: [0xc3] | ||
entry: | ||
%t= load i16, ptr %a | ||
%sub = sub nsw i16 %t, 123 | ||
%sub = sub nsw i16 %t, -128 | ||
ret i16 %sub | ||
} | ||
|
||
define i32 @sub32mi8(ptr %a) { | ||
; CHECK-LABEL: sub32mi8: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: addl $-123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x07,0x85] | ||
; CHECK-NEXT: subl $-128, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x2f,0x80] | ||
; CHECK-NEXT: retq # encoding: [0xc3] | ||
entry: | ||
%t= load i32, ptr %a | ||
%sub = sub nsw i32 %t, 123 | ||
%sub = sub nsw i32 %t, -128 | ||
ret i32 %sub | ||
} | ||
|
||
define i64 @sub64mi8(ptr %a) { | ||
; CHECK-LABEL: sub64mi8: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: addq $-123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x07,0x85] | ||
; CHECK-NEXT: subq $-128, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x2f,0x80] | ||
; CHECK-NEXT: retq # encoding: [0xc3] | ||
entry: | ||
%t= load i64, ptr %a | ||
%sub = sub nsw i64 %t, 123 | ||
%sub = sub nsw i64 %t, -128 | ||
ret i64 %sub | ||
} | ||
|
||
|
@@ -282,12 +282,12 @@ entry: | |
define i64 @sub64mi(ptr %a) { | ||
; CHECK-LABEL: sub64mi: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: addq $-123456, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x07,0xc0,0x1d,0xfe,0xff] | ||
; CHECK-NEXT: # imm = 0xFFFE1DC0 | ||
; CHECK-NEXT: subq $-2147483648, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x2f,0x00,0x00,0x00,0x80] | ||
; CHECK-NEXT: # imm = 0x80000000 | ||
; CHECK-NEXT: retq # encoding: [0xc3] | ||
entry: | ||
%t= load i64, ptr %a | ||
%sub = sub nsw i64 %t, 123456 | ||
%sub = sub nsw i64 %t, -2147483648 | ||
ret i64 %sub | ||
} | ||
|
||
|
The pattern is for add 128, why testing fro sub -128?