1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -mattr=+code-object-v3 < %s | FileCheck --check-prefixes=ALL-ASM,OSABI-AMDHSA-ASM %s
2 ; RUN: llc -filetype=obj -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -mattr=+code-object-v3 < %s | llvm-readelf --notes -relocations -sections -symbols | FileCheck --check-prefixes=ALL-ELF,OSABI-AMDHSA-ELF %s
4 ; ALL-ASM-LABEL: {{^}}fadd:
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
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
24 ; ALL-ASM-LABEL: {{^}}fsub:
26 ; OSABI-AMDHSA-ASM-NOT: .amdgpu_hsa_kernel
27 ; OSABI-AMDHSA-ASM-NOT: .amd_kernel_code_t
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
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
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
52 ; OSABI-AMDHSA-ELF: Relocation section '.rela.rodata' at offset
53 ; OSABI-AMDHSA-ELF: 0000000000000010 0000000100000005 R_AMDGPU_REL64 0000000000000000 fadd + 10
54 ; OSABI-AMDHSA-ELF: 0000000000000050 0000000300000005 R_AMDGPU_REL64 0000000000000100 fsub + 10
56 ; OSABI-AMDHSA-ELF: Symbol table '.symtab' contains {{[0-9]+}} entries
57 ; OSABI-AMDHSA-ELF: {{[0-9]+}}: 0000000000000000 {{[0-9]+}} FUNC GLOBAL PROTECTED {{[0-9]+}} fadd
58 ; OSABI-AMDHSA-ELF: {{[0-9]+}}: 0000000000000000 64 OBJECT GLOBAL DEFAULT {{[0-9]+}} fadd.kd
59 ; OSABI-AMDHSA-ELF: {{[0-9]+}}: 0000000000000100 {{[0-9]+}} FUNC GLOBAL PROTECTED {{[0-9]+}} fsub
60 ; OSABI-AMDHSA-ELF: {{[0-9]+}}: 0000000000000040 64 OBJECT GLOBAL DEFAULT {{[0-9]+}} fsub.kd
62 ; OSABI-AMDHSA-ELF: Displaying notes found at file offset
63 ; OSABI-AMDHSA-ELF: AMDGPU 0x{{[0-9a-f]+}} NT_AMDGPU_METADATA (AMDGPU Metadata)
65 define amdgpu_kernel void @fadd(
66 float addrspace(1)* %r,
67 float addrspace(1)* %a,
68 float addrspace(1)* %b) {
70 %a.val = load float, float addrspace(1)* %a
71 %b.val = load float, float addrspace(1)* %b
72 %r.val = fadd float %a.val, %b.val
73 store float %r.val, float addrspace(1)* %r
77 define amdgpu_kernel void @fsub(
78 float addrspace(1)* %r,
79 float addrspace(1)* %a,
80 float addrspace(1)* %b) {
82 %a.val = load float, float addrspace(1)* %a
83 %b.val = load float, float addrspace(1)* %b
84 %r.val = fsub float %a.val, %b.val
85 store float %r.val, float addrspace(1)* %r