[clang][bytecode] Implement __builtin_arithmetic_fence (#113937)
This commit is contained in:
parent
7c554265ce
commit
b46a0482f9
@ -1670,6 +1670,15 @@ static bool interp__builtin_operator_delete(InterpState &S, CodePtr OpPC,
|
|||||||
S, OpPC, *AllocForm, DynamicAllocator::Form::Operator, BlockDesc, Source);
|
S, OpPC, *AllocForm, DynamicAllocator::Form::Operator, BlockDesc, Source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool interp__builtin_arithmetic_fence(InterpState &S, CodePtr OpPC,
|
||||||
|
const InterpFrame *Frame,
|
||||||
|
const Function *Func,
|
||||||
|
const CallExpr *Call) {
|
||||||
|
const Floating &Arg0 = S.Stk.peek<Floating>();
|
||||||
|
S.Stk.push<Floating>(Arg0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
|
bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
|
||||||
const CallExpr *Call, uint32_t BuiltinID) {
|
const CallExpr *Call, uint32_t BuiltinID) {
|
||||||
const InterpFrame *Frame = S.Current;
|
const InterpFrame *Frame = S.Current;
|
||||||
@ -2111,6 +2120,11 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
|
|||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Builtin::BI__arithmetic_fence:
|
||||||
|
if (!interp__builtin_arithmetic_fence(S, OpPC, Frame, F, Call))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
S.FFDiag(S.Current->getLocation(OpPC),
|
S.FFDiag(S.Current->getLocation(OpPC),
|
||||||
diag::note_invalid_subexpr_in_const_expr)
|
diag::note_invalid_subexpr_in_const_expr)
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - -verify -x c++ %s
|
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - -verify -x c++ %s
|
||||||
|
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - -verify -x c++ %s -fexperimental-new-constant-interpreter
|
||||||
// RUN: %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -verify -x c++ %s
|
// RUN: %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -verify -x c++ %s
|
||||||
|
// RUN: %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -verify -x c++ %s -fexperimental-new-constant-interpreter
|
||||||
// RUN: not %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -x c++ %s \
|
// RUN: not %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -x c++ %s \
|
||||||
// RUN: -fprotect-parens 2>&1 | FileCheck -check-prefix=PPC %s
|
// RUN: -fprotect-parens 2>&1 | FileCheck -check-prefix=PPC %s
|
||||||
|
// RUN: not %clang_cc1 -triple ppc64le -DPPC -emit-llvm -o - -x c++ %s -fexperimental-new-constant-interpreter \
|
||||||
|
// RUN: -fprotect-parens 2>&1 | FileCheck -check-prefix=PPC %s
|
||||||
// RUN: %clang_cc1 -triple spir64 -emit-llvm -o - -verify -x c++ %s
|
// RUN: %clang_cc1 -triple spir64 -emit-llvm -o - -verify -x c++ %s
|
||||||
|
// RUN: %clang_cc1 -triple spir64 -emit-llvm -o - -verify -x c++ %s -fexperimental-new-constant-interpreter
|
||||||
#ifndef PPC
|
#ifndef PPC
|
||||||
int v;
|
int v;
|
||||||
template <typename T> T addT(T a, T b) {
|
template <typename T> T addT(T a, T b) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user