1; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 < %s | FileCheck --check-prefixes=ALL-ASM,OSABI-AMDHSA-ASM %s 2; RUN: llc -filetype=obj -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 < %s | llvm-readelf --notes -relocations -sections -symbols - | FileCheck --check-prefixes=ALL-ELF,OSABI-AMDHSA-ELF %s 3 4; ALL-ASM-LABEL: {{^}}fadd: 5 6; OSABI-AMDHSA-ASM-NOT: .hsa_code_object_version 7; OSABI-AMDHSA-ASM-NOT: .hsa_code_object_isa 8; OSABI-AMDHSA-ASM-NOT: .amdgpu_hsa_kernel 9; OSABI-AMDHSA-ASM-NOT: .amd_kernel_code_t 10 11; OSABI-AMDHSA-ASM: s_endpgm 12; OSABI-AMDHSA-ASM: .section .rodata,#alloc 13; OSABI-AMDHSA-ASM: .p2align 6 14; OSABI-AMDHSA-ASM: .amdhsa_kernel fadd 15; OSABI-AMDHSA-ASM: .amdhsa_user_sgpr_private_segment_buffer 1 16; OSABI-AMDHSA-ASM: .amdhsa_user_sgpr_kernarg_segment_ptr 1 17; OSABI-AMDHSA-ASM: .amdhsa_next_free_vgpr 3 18; OSABI-AMDHSA-ASM: .amdhsa_next_free_sgpr 8 19; OSABI-AMDHSA-ASM: .amdhsa_reserve_vcc 0 20; OSABI-AMDHSA-ASM: .amdhsa_reserve_flat_scratch 0 21; OSABI-AMDHSA-ASM: .end_amdhsa_kernel 22; OSABI-AMDHSA-ASM: .text 23 24; ALL-ASM-LABEL: {{^}}fsub: 25 26; OSABI-AMDHSA-ASM-NOT: .amdgpu_hsa_kernel 27; OSABI-AMDHSA-ASM-NOT: .amd_kernel_code_t 28 29; OSABI-AMDHSA-ASM: s_endpgm 30; OSABI-AMDHSA-ASM: .section .rodata,#alloc 31; OSABI-AMDHSA-ASM: .p2align 6 32; OSABI-AMDHSA-ASM: .amdhsa_kernel fsub 33; OSABI-AMDHSA-ASM: .amdhsa_user_sgpr_private_segment_buffer 1 34; OSABI-AMDHSA-ASM: .amdhsa_user_sgpr_kernarg_segment_ptr 1 35; OSABI-AMDHSA-ASM: .amdhsa_next_free_vgpr 3 36; OSABI-AMDHSA-ASM: .amdhsa_next_free_sgpr 8 37; OSABI-AMDHSA-ASM: .amdhsa_reserve_vcc 0 38; OSABI-AMDHSA-ASM: .amdhsa_reserve_flat_scratch 0 39; OSABI-AMDHSA-ASM: .end_amdhsa_kernel 40; OSABI-AMDHSA-ASM: .text 41 42; OSABI-AMDHSA-ASM-NOT: .hsa_code_object_version 43; OSABI-AMDHSA-ASM-NOT: .hsa_code_object_isa 44; OSABI-AMDHSA-ASM-NOT: .amd_amdgpu_isa 45; OSABI-AMDHSA-ASM-NOT: .amd_amdgpu_hsa_metadata 46; OSABI-AMDHSA-ASM-NOT: .amd_amdgpu_pal_metadata 47 48; OSABI-AMDHSA-ELF: Section Headers 49; OSABI-AMDHSA-ELF: .text PROGBITS {{[0-9]+}} {{[0-9]+}} {{[0-9a-f]+}} {{[0-9]+}} AX {{[0-9]+}} {{[0-9]+}} 256 50; OSABI-AMDHSA-ELF: .rodata PROGBITS {{[0-9]+}} {{[0-9]+}} {{[0-9a-f]+}} {{[0-9]+}} A {{[0-9]+}} {{[0-9]+}} 64 51 52; OSABI-AMDHSA-ELF: Relocation section '.rela.rodata' at offset 53; OSABI-AMDHSA-ELF: 0000000000000010 0000000300000005 R_AMDGPU_REL64 0000000000000000 fadd + 10 54; OSABI-AMDHSA-ELF: 0000000000000050 0000000500000005 R_AMDGPU_REL64 0000000000000100 fsub + 10 55; OSABI-AMDHSA-ELF: 0000000000000090 0000000100000005 R_AMDGPU_REL64 0000000000000200 empty + 10 56 57; OSABI-AMDHSA-ELF: Symbol table '.symtab' contains {{[0-9]+}} entries 58; OSABI-AMDHSA-ELF: {{[0-9]+}}: 0000000000000000 {{[0-9]+}} FUNC GLOBAL PROTECTED {{[0-9]+}} fadd 59; OSABI-AMDHSA-ELF: {{[0-9]+}}: 0000000000000000 64 OBJECT GLOBAL DEFAULT {{[0-9]+}} fadd.kd 60; OSABI-AMDHSA-ELF: {{[0-9]+}}: 0000000000000100 {{[0-9]+}} FUNC GLOBAL PROTECTED {{[0-9]+}} fsub 61; OSABI-AMDHSA-ELF: {{[0-9]+}}: 0000000000000040 64 OBJECT GLOBAL DEFAULT {{[0-9]+}} fsub.kd 62 63; OSABI-AMDHSA-ELF: Displaying notes found in: .note 64; OSABI-AMDHSA-ELF: AMDGPU 0x{{[0-9a-f]+}} NT_AMDGPU_METADATA (AMDGPU Metadata) 65 66define amdgpu_kernel void @fadd( 67 float addrspace(1)* %r, 68 float addrspace(1)* %a, 69 float addrspace(1)* %b) { 70entry: 71 %a.val = load float, float addrspace(1)* %a 72 %b.val = load float, float addrspace(1)* %b 73 %r.val = fadd float %a.val, %b.val 74 store float %r.val, float addrspace(1)* %r 75 ret void 76} 77 78define amdgpu_kernel void @fsub( 79 float addrspace(1)* %r, 80 float addrspace(1)* %a, 81 float addrspace(1)* %b) { 82entry: 83 %a.val = load float, float addrspace(1)* %a 84 %b.val = load float, float addrspace(1)* %b 85 %r.val = fsub float %a.val, %b.val 86 store float %r.val, float addrspace(1)* %r 87 ret void 88} 89 90; Make sure kernel arguments do not count towards the number of 91; registers used. 92; 93; ALL-ASM-LABEL: {{^}}empty: 94; ALL-ASM: .amdhsa_next_free_vgpr 1 95; ALL-ASM: .amdhsa_next_free_sgpr 1 96define amdgpu_kernel void @empty( 97 i32 %i, 98 float addrspace(1)* %r, 99 float addrspace(1)* %a, 100 float addrspace(1)* %b) { 101entry: 102 ret void 103} 104