Skip to content

Commit 6136f23

Browse files
committed
Apply CR suggestions
1 parent ac48e18 commit 6136f23

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20465,7 +20465,7 @@ RValue CodeGenFunction::EmitIntelFPGAMemBuiltin(const CallExpr *E) {
2046520465
assert(CacheSize.hasValue() && "Constant arg isn't actually constant?");
2046620466
Out << "{cache-size:" << toString(*CacheSize, 10) << "}";
2046720467

20468-
// There is four optional arguments with following default values:
20468+
// There are four optional arguments with the following default values:
2046920469
// const int32_t AnchorID = -1
2047020470
// const int32_t TargetAnchor = 0
2047120471
// const int32_t Type = 0

clang/lib/Sema/SemaChecking.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4863,7 +4863,7 @@ bool Sema::CheckIntelFPGAMemBuiltinFunctionCall(CallExpr *TheCall) {
48634863
const unsigned MaxNumArgs = 7;
48644864
unsigned NumArgs = TheCall->getNumArgs();
48654865

4866-
// Make sure we have minimum number of provided arguments.
4866+
// Make sure we have the minimum number of provided arguments.
48674867
if (NumArgs < MinNumArgs)
48684868
return Diag(TheCall->getEndLoc(),
48694869
diag::err_typecheck_call_too_few_args_at_least)
@@ -4911,7 +4911,7 @@ bool Sema::CheckIntelFPGAMemBuiltinFunctionCall(CallExpr *TheCall) {
49114911
return Diag(TheCall->getArg(2)->getBeginLoc(),
49124912
diag::err_intel_fpga_mem_arg_mismatch) << 1;
49134913

4914-
// The last four optional arguments must be signed integers.
4914+
// The last four optional arguments must be signed constant integers.
49154915
for (unsigned I = MinNumArgs; I != NumArgs; ++I) {
49164916
if (SemaBuiltinConstantArg(TheCall, I, Result))
49174917
return true;

clang/test/CodeGenSYCL/intel-fpga-mem-builtin.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#define PARAM_1 1U << 7
44
#define PARAM_2 1U << 8
55

6+
// This test checks that using of __builtin_intel_fpga_mem results in correct
7+
// generation of annotations in LLVM IR.
8+
69
// CHECK: [[STRUCT:%.*]] = type { i32, float }
710
struct State {
811
int x;
@@ -14,7 +17,7 @@ struct State {
1417
// CHECK: [[ANN3:@.str[\.]*[0-9]*]] = {{.*}}{params:384}{cache-size:127}{anchor-id:10}{target-anchor:20}{type:30}{cycle:40}
1518
// CHECK: [[ANN4:@.str[\.]*[0-9]*]] = {{.*}}{params:384}{cache-size:127}{anchor-id:11}{target-anchor:12}{type:0}{cycle:0}
1619
// CHECK: [[ANN5:@.str[\.]*[0-9]*]] = {{.*}}{params:384}{cache-size:127}{anchor-id:100}{target-anchor:0}{type:0}{cycle:0}
17-
// CHECK: [[ANN6:@.str[\.]*[0-9]*]] = {{.*}}{params:384}{cache-size:128}{anchor-id:4}{target-anchor:5}{type:6}{cycle:0}
20+
// CHECK: [[ANN6:@.str[\.]*[0-9]*]] = {{.*}}{params:384}{cache-size:128}{anchor-id:4}{target-anchor:7}{type:8}{cycle:0}
1821

1922
// CHECK: define {{.*}}spir_func void @{{.*}}(float addrspace(4)* %A, i32 addrspace(4)* %B, [[STRUCT]] addrspace(4)* %C, [[STRUCT]] addrspace(4)*{{.*}}%D)
2023
void foo(float *A, int *B, State *C, State &D) {
@@ -85,10 +88,13 @@ void foo(float *A, int *B, State *C, State &D) {
8588
// CHECK-DAG: store i32 addrspace(4)* [[PTR11]], i32 addrspace(4)* addrspace(4)* %y
8689
y = __builtin_intel_fpga_mem(B, PARAM_1 | PARAM_2, 127, 100);
8790

91+
constexpr TestVal1 = 7;
92+
constexpr TestVal2 = 8;
93+
8894
// CHECK-DAG: [[D1:%[0-9]+]] = load [[STRUCT]] addrspace(4)*, [[STRUCT]] addrspace(4)* addrspace(4)* [[Daddr]]
8995
// CHECK-DAG: [[PTR12:%[0-9]+]] = call [[STRUCT]] addrspace(4)* @llvm.ptr.annotation{{.*}}[[D1]]{{.*}}[[ANN6]]{{.*}}[[ATT:#[0-9]+]]
9096
// CHECK-DAG: store [[STRUCT]] addrspace(4)* [[PTR12]], [[STRUCT]] addrspace(4)* addrspace(4)* %z
91-
z = __builtin_intel_fpga_mem(&D, PARAM_1 | PARAM_2, 128, 4, 5, 6);
97+
z = __builtin_intel_fpga_mem(&D, PARAM_1 | PARAM_2, 128, 4, TestVal1, TestVal2);
9298
}
9399

94100
// CHECK-DAG: attributes [[ATT]] = { readnone }

clang/test/SemaSYCL/intel-fpga-mem-builtin.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#define PARAM_1 1U << 7
55
#define PARAM_2 1U << 8
66

7+
// This test makes sure that the compiler checks the semantics of
8+
// __builtin_intel_fpga_mem built-in function arguments correctly.
9+
710
#ifdef __SYCL_DEVICE_ONLY__
811
static_assert(__has_builtin(__builtin_intel_fpga_mem), "");
912
struct State {

0 commit comments

Comments
 (0)