[PATCH] D130096: [Clang][AMDGPU] Emit AMDGPU library control constants in clang

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 07:45:20 PDT 2022


yaxunl added inline comments.


================
Comment at: clang/test/CodeGen/amdgcn-link-control-constants.c:2-3
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-globals --include-generated-funcs --global-value-regex "__oclc_daz_opt"
+// RUN: %clang_cc1 -x hip -triple amdgcn-amd-amdhsa -target-cpu gfx90a -emit-llvm-bc -o %t.bc -DLIBRARY %s
+// RUN: %clang_cc1 -x hip -triple amdgcn-amd-amdhsa -target-cpu gfx90a -mlink-builtin-bitcode %t.bc -S -emit-llvm -o - %s | FileCheck %s
+
----------------
This is compiling HIP as host. Please add -fcuda-is-device.


================
Comment at: clang/test/CodeGen/amdgcn-link-control-constants.c:7
+
+extern unsigned char [[clang::address_space(5)]] __oclc_daz_opt;
+
----------------
use `__constant__` instead


================
Comment at: clang/test/CodeGen/amdgcn-link-control-constants.c:9
+
+int foo(void) {
+  return __oclc_daz_opt ? 1 : 0;
----------------
add `__device__`


================
Comment at: clang/test/CodeGen/amdgcn-link-control-constants.c:15
+
+extern int foo(void);
+
----------------
add `__device__`


================
Comment at: clang/test/CodeGen/amdgcn-link-control-constants.c:17
+
+void bar(void) {
+  foo();
----------------
add `__device__`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130096/new/

https://reviews.llvm.org/D130096



More information about the cfe-commits mailing list