[llvm] [NFC][SystemZ] Use SExt for signed constants (PR #118803)

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 06:49:22 PST 2024


https://github.com/redstar updated https://github.com/llvm/llvm-project/pull/118803

>From f0cb15bd99012146fb427178d96aced573552c39 Mon Sep 17 00:00:00 2001
From: Kai Nacke <kai.peter.nacke at ibm.com>
Date: Thu, 5 Dec 2024 08:41:31 -0500
Subject: [PATCH] [NFC][SystemZ] Use SExt for signed constants

Use SExt instead of ZExt in XForms which produce a signed value. This is only to make it clear that the XForm handles a signed value.
---
 llvm/lib/Target/SystemZ/SystemZOperands.td | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/SystemZ/SystemZOperands.td b/llvm/lib/Target/SystemZ/SystemZOperands.td
index 5349e0d9a8512c..e7b45a40a3cc0b 100644
--- a/llvm/lib/Target/SystemZ/SystemZOperands.td
+++ b/llvm/lib/Target/SystemZ/SystemZOperands.td
@@ -220,7 +220,7 @@ def NEGLF32 : SDNodeXForm<imm, [{
 
 // Truncate an immediate to a 8-bit signed quantity.
 def SIMM8 : SDNodeXForm<imm, [{
-  return CurDAG->getSignedTargetConstant(int8_t(N->getZExtValue()), SDLoc(N),
+  return CurDAG->getSignedTargetConstant(int8_t(N->getSExtValue()), SDLoc(N),
                                          MVT::i64);
 }]>;
 
@@ -244,13 +244,13 @@ def UIMM12 : SDNodeXForm<imm, [{
 
 // Truncate an immediate to a 16-bit signed quantity.
 def SIMM16 : SDNodeXForm<imm, [{
-  return CurDAG->getSignedTargetConstant(int16_t(N->getZExtValue()), SDLoc(N),
+  return CurDAG->getSignedTargetConstant(int16_t(N->getSExtValue()), SDLoc(N),
                                          MVT::i64);
 }]>;
 
 // Negate and then truncate an immediate to a 16-bit signed quantity.
 def NEGSIMM16 : SDNodeXForm<imm, [{
-  return CurDAG->getSignedTargetConstant(int16_t(-N->getZExtValue()), SDLoc(N),
+  return CurDAG->getSignedTargetConstant(int16_t(-N->getSExtValue()), SDLoc(N),
                                          MVT::i64);
 }]>;
 
@@ -262,13 +262,13 @@ def UIMM16 : SDNodeXForm<imm, [{
 
 // Truncate an immediate to a 32-bit signed quantity.
 def SIMM32 : SDNodeXForm<imm, [{
-  return CurDAG->getSignedTargetConstant(int32_t(N->getZExtValue()), SDLoc(N),
+  return CurDAG->getSignedTargetConstant(int32_t(N->getSExtValue()), SDLoc(N),
                                          MVT::i64);
 }]>;
 
 // Negate and then truncate an immediate to a 32-bit unsigned quantity.
 def NEGSIMM32 : SDNodeXForm<imm, [{
-  return CurDAG->getSignedTargetConstant(int32_t(-N->getZExtValue()), SDLoc(N),
+  return CurDAG->getSignedTargetConstant(int32_t(-N->getSExtValue()), SDLoc(N),
                                          MVT::i64);
 }]>;
 



More information about the llvm-commits mailing list