[PATCH] D69789: [clang,MveEmitter] Fix sign/zero extension in range limits.

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 6 01:09:41 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG26bc7cb05edd: [clang,MveEmitter] Fix sign/zero extension in range limits. (authored by simon_tatham).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69789/new/

https://reviews.llvm.org/D69789

Files:
  clang/utils/TableGen/MveEmitter.cpp


Index: clang/utils/TableGen/MveEmitter.cpp
===================================================================
--- clang/utils/TableGen/MveEmitter.cpp
+++ clang/utils/TableGen/MveEmitter.cpp
@@ -782,15 +782,14 @@
       }
 
       llvm::APInt typelo, typehi;
-      if (cast<ScalarType>(IA.ArgType)->kind() == ScalarTypeKind::UnsignedInt) {
-        typelo = llvm::APInt::getSignedMinValue(IA.ArgType->sizeInBits());
-        typehi = llvm::APInt::getSignedMaxValue(IA.ArgType->sizeInBits());
+      unsigned Bits = IA.ArgType->sizeInBits();
+      if (cast<ScalarType>(IA.ArgType)->kind() == ScalarTypeKind::SignedInt) {
+        typelo = llvm::APInt::getSignedMinValue(Bits).sext(128);
+        typehi = llvm::APInt::getSignedMaxValue(Bits).sext(128);
       } else {
-        typelo = llvm::APInt::getMinValue(IA.ArgType->sizeInBits());
-        typehi = llvm::APInt::getMaxValue(IA.ArgType->sizeInBits());
+        typelo = llvm::APInt::getMinValue(Bits).zext(128);
+        typehi = llvm::APInt::getMaxValue(Bits).zext(128);
       }
-      typelo = typelo.sext(128);
-      typehi = typehi.sext(128);
 
       std::string Index = utostr(kv.first);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69789.228016.patch
Type: text/x-patch
Size: 1156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191106/d6fd9944/attachment.bin>


More information about the cfe-commits mailing list