Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2047,8 +2047,8 @@ "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 { Index: test/CodeGenOpenCL/amdgcn-flat-scratch-name.cl =================================================================== --- /dev/null +++ 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"); +}