diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 040dedaff145..382ac9cd9865 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -2022,8 +2022,8 @@ const char * const AMDGPUTargetInfo::GCCRegNames[] = { "s104", "s105", "s106", "s107", "s108", "s109", "s110", "s111", "s112", "s113", "s114", "s115", "s116", "s117", "s118", "s119", "s120", "s121", "s122", "s123", "s124", "s125", "s126", "s127" - "exec", "vcc", "scc", "m0", "flat_scr", "exec_lo", "exec_hi", - "vcc_lo", "vcc_hi", "flat_scr_lo", "flat_scr_hi" + "exec", "vcc", "scc", "m0", "flat_scratch", "exec_lo", "exec_hi", + "vcc_lo", "vcc_hi", "flat_scratch_lo", "flat_scratch_hi" }; ArrayRef AMDGPUTargetInfo::getGCCRegNames() const { diff --git a/clang/test/CodeGenOpenCL/amdgcn-flat-scratch-name.cl b/clang/test/CodeGenOpenCL/amdgcn-flat-scratch-name.cl new file mode 100644 index 000000000000..3a98e9099f52 --- /dev/null +++ b/clang/test/CodeGenOpenCL/amdgcn-flat-scratch-name.cl @@ -0,0 +1,15 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK-LABEL: @use_flat_scratch_name +kernel void use_flat_scratch_name() +{ +// CHECK: tail call void asm sideeffect "s_mov_b64 flat_scratch, 0", "~{flat_scratch}"() + __asm__ volatile("s_mov_b64 flat_scratch, 0" : : : "flat_scratch"); + +// CHECK: tail call void asm sideeffect "s_mov_b32 flat_scratch_lo, 0", "~{flat_scratch_lo}"() + __asm__ volatile("s_mov_b32 flat_scratch_lo, 0" : : : "flat_scratch_lo"); + +// CHECK: tail call void asm sideeffect "s_mov_b32 flat_scratch_hi, 0", "~{flat_scratch_hi}"() + __asm__ volatile("s_mov_b32 flat_scratch_hi, 0" : : : "flat_scratch_hi"); +}