-
Notifications
You must be signed in to change notification settings - Fork 15k
[TableGen][X86] Add X86 support for llvm::MCInstrDesc::isAdd
#119057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[TableGen][X86] Add X86 support for llvm::MCInstrDesc::isAdd
#119057
Conversation
Currently, the semantic of X86's add instructions is not represented in `MCInstrDesc::isAdd`. This commit adds this support by adding the `isAdd = 1` flag in tablegen definition.
@llvm/pr-subscribers-backend-x86 Author: Romain Thomas (romainthomas) ChangesCurrently, the semantic of X86's add instructions is not represented in This commit adds this support by adding the Full diff: https://github.com/llvm/llvm-project/pull/119057.diff 1 Files Affected:
diff --git a/llvm/lib/Target/X86/X86InstrArithmetic.td b/llvm/lib/Target/X86/X86InstrArithmetic.td
index 16ca2882a84daf..4a9b16aac81d56 100644
--- a/llvm/lib/Target/X86/X86InstrArithmetic.td
+++ b/llvm/lib/Target/X86/X86InstrArithmetic.td
@@ -1080,8 +1080,11 @@ defm OR : ArithBinOp_RF<0x09, 0x0B, 0x0D, "or", MRM1r, MRM1m,
X86or_flag, or, 1, 0, 0>;
defm XOR : ArithBinOp_RF<0x31, 0x33, 0x35, "xor", MRM6r, MRM6m,
X86xor_flag, xor, 1, 0, 0>;
-defm ADD : ArithBinOp_RF<0x01, 0x03, 0x05, "add", MRM0r, MRM0m,
- X86add_flag, add, 1, 1, 1>;
+let isAdd = 1 in {
+ defm ADD : ArithBinOp_RF<0x01, 0x03, 0x05, "add", MRM0r, MRM0m,
+ X86add_flag, add, 1, 1, 1>;
+}
+
let isCompare = 1 in {
defm SUB : ArithBinOp_RF<0x29, 0x2B, 0x2D, "sub", MRM5r, MRM5m,
X86sub_flag, sub, 0, 1, 0>;
@@ -1097,8 +1100,10 @@ let isCodeGenOnly = 1, hasSideEffects = 0, Constraints = "$src1 = $dst",
Sched<[WriteALU]>;
// Arithmetic.
-defm ADC : ArithBinOp_RFF<0x11, 0x13, 0x15, "adc", MRM2r, MRM2m, X86adc_flag,
- 1, 0>;
+let isAdd = 1 in {
+ defm ADC : ArithBinOp_RFF<0x11, 0x13, 0x15, "adc", MRM2r, MRM2m, X86adc_flag,
+ 1, 0>;
+}
defm SBB : ArithBinOp_RFF<0x19, 0x1B, 0x1D, "sbb", MRM3r, MRM3m, X86sbb_flag,
0, 0>;
|
Tests? |
Nevermind I guess you can't test it because the MCInstrDesc::isAdd is only used in 2 places in target specific code.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's wait for another feedback though.
@@ -1097,8 +1100,10 @@ let isCodeGenOnly = 1, hasSideEffects = 0, Constraints = "$src1 = $dst", | |||
Sched<[WriteALU]>; | |||
|
|||
// Arithmetic. | |||
defm ADC : ArithBinOp_RFF<0x11, 0x13, 0x15, "adc", MRM2r, MRM2m, X86adc_flag, | |||
1, 0>; | |||
let isAdd = 1 in { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without knowing what the flag is used for, it's hard to say whether an Add with carry input should be consider an add.
Currently, the semantic of X86's add instructions is not represented in
MCInstrDesc::isAdd
.This commit adds this support by adding the
isAdd = 1
flag in tablegen definition.