aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic
diff options
context:
space:
mode:
authorWenju He <wenju.he@intel.com>2025-07-17 09:02:10 +0800
committerGitHub <noreply@github.com>2025-07-17 09:02:10 +0800
commitb41398294c85eacdb37b9637eed6f0e91edf35cf (patch)
tree150db1ac0ad02e130a3df495b440f5aaa25f354d /clang/lib/Basic
parent0692572e040979b2de0dceb8f0537aa16caf351f (diff)
downloadllvm-b41398294c85eacdb37b9637eed6f0e91edf35cf.zip
llvm-b41398294c85eacdb37b9637eed6f0e91edf35cf.tar.gz
llvm-b41398294c85eacdb37b9637eed6f0e91edf35cf.tar.bz2
[SPIR] Set MaxAtomicInlineWidth minimum size to 32 for spir32 and 64 for spir64 (#148997)
Set MaxAtomicInlineWidth the same way as SPIR-V targets in 3cfd0c0d3697. This PR fixes build warning in scoped atomic built-in in #146814: `warning: large atomic operation may incur significant performance penalty; ; the access size (2 bytes) exceeds the max lock-free size (0 bytes) [-Watomic-alignment]`
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r--clang/lib/Basic/Targets/SPIR.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h
index 1abf798..c13b286 100644
--- a/clang/lib/Basic/Targets/SPIR.h
+++ b/clang/lib/Basic/Targets/SPIR.h
@@ -264,6 +264,9 @@ public:
PointerWidth = PointerAlign = 32;
SizeType = TargetInfo::UnsignedInt;
PtrDiffType = IntPtrType = TargetInfo::SignedInt;
+ // SPIR32 has support for atomic ops if atomic extension is enabled.
+ // Take the maximum because it's possible the Host supports wider types.
+ MaxAtomicInlineWidth = std::max<unsigned char>(MaxAtomicInlineWidth, 32);
resetDataLayout("e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-"
"v96:128-v192:256-v256:256-v512:512-v1024:1024-G1");
}
@@ -281,6 +284,9 @@ public:
PointerWidth = PointerAlign = 64;
SizeType = TargetInfo::UnsignedLong;
PtrDiffType = IntPtrType = TargetInfo::SignedLong;
+ // SPIR64 has support for atomic ops if atomic extension is enabled.
+ // Take the maximum because it's possible the Host supports wider types.
+ MaxAtomicInlineWidth = std::max<unsigned char>(MaxAtomicInlineWidth, 64);
resetDataLayout("e-i64:64-v16:16-v24:32-v32:32-v48:64-"
"v96:128-v192:256-v256:256-v512:512-v1024:1024-G1");
}