[clang] 413aaf1 - [clang][Interp][NFC] Support IntAP(S) in emitPrimCast

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed May 15 08:13:00 PDT 2024


Author: Timm Bäder
Date: 2024-05-15T17:12:41+02:00
New Revision: 413aaf11cd74f422f05b990613f822dc10db4391

URL: https://github.com/llvm/llvm-project/commit/413aaf11cd74f422f05b990613f822dc10db4391
DIFF: https://github.com/llvm/llvm-project/commit/413aaf11cd74f422f05b990613f822dc10db4391.diff

LOG: [clang][Interp][NFC] Support IntAP(S) in emitPrimCast

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 1da74ac7c8bd1..7cdc1c6d1947c 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -3685,12 +3685,22 @@ bool ByteCodeExprGen<Emitter>::emitPrimCast(PrimType FromT, PrimType ToT,
       return this->emitCastFP(ToSem, getRoundingMode(E), E);
     }
 
+    if (ToT == PT_IntAP)
+      return this->emitCastFloatingIntegralAP(Ctx.getBitWidth(ToQT), E);
+    if (ToT == PT_IntAPS)
+      return this->emitCastFloatingIntegralAPS(Ctx.getBitWidth(ToQT), E);
+
     // Float to integral.
     if (isIntegralType(ToT) || ToT == PT_Bool)
       return this->emitCastFloatingIntegral(ToT, E);
   }
 
   if (isIntegralType(FromT) || FromT == PT_Bool) {
+    if (ToT == PT_IntAP)
+      return this->emitCastAP(FromT, Ctx.getBitWidth(ToQT), E);
+    if (ToT == PT_IntAPS)
+      return this->emitCastAPS(FromT, Ctx.getBitWidth(ToQT), E);
+
     // Integral to integral.
     if (isIntegralType(ToT) || ToT == PT_Bool)
       return FromT != ToT ? this->emitCast(FromT, ToT, E) : true;


        


More information about the cfe-commits mailing list