File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -2684,6 +2684,11 @@ void VectorTypeNamespaceRule::runRule(const MatchFinder::MatchResult &Result) {
2684
2684
}
2685
2685
// Runrule for __half_raw implicitly convert to half.
2686
2686
if (auto DRE = getNodeAsType<DeclRefExpr>(Result, "halfRawExpr")) {
2687
+ if (const auto *RT =
2688
+ DRE->getType().getCanonicalType()->getAs<RecordType>()) {
2689
+ if (isUserDefinedDecl(RT->getDecl()))
2690
+ return;
2691
+ }
2687
2692
ExprAnalysis EA;
2688
2693
std::string Replacement;
2689
2694
llvm::raw_string_ostream OS(Replacement);
Original file line number Diff line number Diff line change
1
+ // RUN: dpct --format-range=none --out-root %T/user_defined_half_raw %s --cuda-include-path="%cuda-path/include"
2
+ // RUN: FileCheck %s --match-full-lines --input-file %T/user_defined_half_raw/user_defined_half_raw.dp.cpp
3
+ // RUN: %if build_lit %{icpx -c -fsycl %T/user_defined_half_raw/user_defined_half_raw.dp.cpp -o %T/user_defined_half_raw/user_defined_half_raw.dp.o %}
4
+
5
+ struct __half_raw {
6
+ __device__ __half_raw () : _raw(0 ) {}
7
+ explicit __device__ __half_raw (unsigned short raw) : _raw(raw) {}
8
+ unsigned short _raw;
9
+ };
10
+
11
+ // CHECK: __half_raw foo(unsigned short x) {
12
+ // CHECK-NEXT: __half_raw h;
13
+ // CHECK-NEXT: h._raw = x;
14
+ // CHECK-NEXT: return h;
15
+ // CHECK-NEXT: }
16
+ __device__ __half_raw foo (unsigned short x) {
17
+ __half_raw h;
18
+ h._raw = x;
19
+ return h;
20
+ }
You can’t perform that action at this time.
0 commit comments