Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin S Bobrovsky <konstantin.s.bobrovsky@intel.com>
  • Loading branch information
kbobrovs committed Mar 12, 2022
1 parent f154d32 commit 8e942de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
7 changes: 3 additions & 4 deletions clang/lib/Basic/Targets/SPIR.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo {
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
return (CC == CC_SpirFunction || CC == CC_OpenCLKernel ||
// Permit CC_X86RegCall which is used to mark external functions
// with
// explicit simd or structure type arguments to pass them via
// registers.
// with explicit simd or structure type arguments to pass them via
// registers.
CC == CC_X86RegCall)
? CCCR_OK
: CCCR_Warning;
Expand Down Expand Up @@ -295,7 +294,7 @@ class LLVM_LIBRARY_VISIBILITY WindowsX86_64_SPIR64TargetInfo
if (CC == CC_X86VectorCall || CC == CC_X86RegCall)
// Permit CC_X86VectorCall which is used in Microsoft headers
// Permit CC_X86RegCall which is used to mark external functions with
// explicit simd or structure type arguments to pass them via registers.
// explicit simd or structure type arguments to pass them via registers.
return CCCR_OK;
return (CC == CC_SpirFunction || CC == CC_OpenCLKernel) ? CCCR_OK
: CCCR_Warning;
Expand Down
9 changes: 4 additions & 5 deletions clang/test/CodeGenSYCL/regcall-cc-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ template SYCL_DEVICE C2 __regcall func<C2>(C2 x);

// === TEST CASE: multi-level nested structs with one primitive type element at
// the bottom, and one - at the top. The nested struct at the top is expected to
// get "unwraped" by the compiler evaporating to the single element at the
// get "unwrapped" by the compiler evaporating to the single element at the
// bottom.

struct A3 { char x; };
Expand All @@ -110,10 +110,9 @@ struct C3 { // unwrapped
template SYCL_DEVICE C3 __regcall func<C3>(C3 x);
// CHECK-DAG: define weak_odr x86_regcallcc i16 @_Z16__regcall3__funcI2C3ET_S1_(i16 %{{[0-9a-zA-Z_.]+}})

// === TEST CASE: multi-level nested structs with one primitive type element at
// the bottom, and one - at the top. The nested struct at the top is expected to
// get "unwraped" by the compiler evaporating to the single element at the
// bottom.
// === TEST CASE: multi-level nested structs with a pointer field at the top
// level. 1 step-deep unwrapping for a function argument type and no unwrapping
// for the return type is expected to happen.

struct A4 { char x; };
struct B4 { A4 a; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ For example, unwrapping `Y` defined as
struct X { int x; };
struct Y { X x; };
```
results in `i32`. Unwrapping `C4` defind as
results in `i32`. Unwrapping `C4` defined as
```cpp
struct A4 { char x; };
struct B4 { A4 a; };
Expand All @@ -564,9 +564,7 @@ the "unwrapped type set".
* 1-2 bytes - short
* 3-4 bytes - int
* 5-8 bytes - array of 2 ints
Floating point types are not merged. Structure field alignment rules can
increase the calculated size compared to simple sum of `sizeof` of all the
types. If the total size exceeds 8, then:
If the total size exceeds 8, then:
* a source parameter of this type is broken down into multiple parameters
with types resulted from unwrapping
* a source return value of this type keeps it (the type)
Expand Down

0 comments on commit 8e942de

Please sign in to comment.