[clang] [clang] handle fp options in __builtin_convertvector (PR #125522)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 3 14:32:01 PST 2025
================
@@ -248,4 +248,16 @@ __attribute__((optnone)) T func_22(T x, T y) {
float func_23(float x, float y) {
return func_22(x, y);
-}
\ No newline at end of file
+}
+
+// CHECK-LABEL: FunctionDecl {{.*}} func_24 'vector2float (vector2double)'
+// CHECK: CompoundStmt {{.*}} FPContractMode=2 ConstRoundingMode=towardzero
+// CHECK: ReturnStmt
+// CHECK: ConvertVectorExpr {{.*}} FPContractMode=2 ConstRoundingMode=towardzero
+
+typedef double vector2double __attribute__((__vector_size__(16)));
+typedef float vector2float __attribute__((__vector_size__(8)));
+#pragma STDC FENV_ROUND FE_TOWARDZERO
----------------
shafik wrote:
I don't see other tests doing this but we should test also the absence of FP options in the AST as well when nothing is set. This would test that we are not incorrectly identifying that `hasStoredFPFeatures()` is true and that we don't get garbage values.
https://github.com/llvm/llvm-project/pull/125522
More information about the cfe-commits
mailing list