llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> Negation can also fail for fixed-point values. --- Full diff: https://github.com/llvm/llvm-project/pull/189033.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Interp.h (+1-1) - (modified) clang/test/Frontend/fixed_point_sub_const.c (+3) ``````````diff diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h index 90dc88c1dbde7..3578ef9da820b 100644 --- a/clang/lib/AST/ByteCode/Interp.h +++ b/clang/lib/AST/ByteCode/Interp.h @@ -720,7 +720,7 @@ bool Neg(InterpState &S, CodePtr OpPC) { return true; } - assert(isIntegerType(Name) && + assert((isIntegerType(Name) || Name == PT_FixedPoint) && "don't expect other types to fail at constexpr negation"); S.Stk.push<T>(Result); diff --git a/clang/test/Frontend/fixed_point_sub_const.c b/clang/test/Frontend/fixed_point_sub_const.c index c98cfd185205c..ab49799673eae 100644 --- a/clang/test/Frontend/fixed_point_sub_const.c +++ b/clang/test/Frontend/fixed_point_sub_const.c @@ -1,6 +1,9 @@ // RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,SIGNED // RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -fpadding-on-unsigned-fixed-point -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,UNSIGNED +// RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK,SIGNED +// RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -fpadding-on-unsigned-fixed-point -emit-llvm %s -o - -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK,UNSIGNED + // Subtraction between different fixed point types short _Accum sa_const = 1.0hk - 2.0hk; // CHECK-DAG: @sa_const = {{.*}}global i16 -128, align 2 `````````` </details> https://github.com/llvm/llvm-project/pull/189033 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
