#include <iostream>
typedef float4 Real3;

void puts(Real3 v){
  std::cout << "(" << v.x << " " << v.y << " " << v.z << ")" << std::endl;
}

Real3 operator+(Real3 v1, Real3 v2){
  Real3 p;
  p.x = v1.x + v2.x;
  p.y = v1.y + v2.y;
  p.z = v1.z = v2.z;
  return p;
}

Real3 genReal3(float x, float y, float z){
  Real3 p;
  p.x = x;
  p.y = y;
  p.z = z;
  return p; 
}

int main(void){
  Real3 p = genReal3(10,20,30);

  puts(p);

  Real3 q = genReal3(40,50,60);
  
  puts(p+q);
  
  return 0;
}
  

	.file	"tmpxft_0039120b_00000000-6_float4.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3641:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3641:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"("
.LC1:
	.string	" "
.LC2:
	.string	")"
	.text
	.globl	_Z4puts6float4
	.type	_Z4puts6float4, @function
_Z4puts6float4:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%xmm1, %rbp
	leaq	.LC1(%rip), %r12
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%xmm0, %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movd	%ebx, %xmm0
	shrq	$32, %rbx
	movq	%rax, %rdi
	cvtss2sd	%xmm0, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movd	%ebx, %xmm2
	movq	%rax, %rdi
	cvtss2sd	%xmm2, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movd	%ebp, %xmm3
	movq	%rax, %rdi
	cvtss2sd	%xmm3, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	movq	%rax, %rdi
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	.cfi_endproc
.LFE3635:
	.size	_Z4puts6float4, .-_Z4puts6float4
	.globl	_Zpl6float4S_
	.type	_Zpl6float4S_, @function
_Zpl6float4S_:
.LFB3636:
	.cfi_startproc
	endbr64
	movq	%xmm0, %rax
	movq	%xmm2, %rdx
	movaps	%xmm0, %xmm1
	movq	%rax, %rcx
	movaps	%xmm2, %xmm0
	movq	%xmm3, %rsi
	movq	%rdx, %rdi
	shrq	$32, %rcx
	shrq	$32, %rdi
	addss	%xmm1, %xmm0
	movd	%esi, %xmm1
	movd	%ecx, %xmm4
	movd	%edi, %xmm5
	addss	%xmm5, %xmm4
	movd	%xmm0, %eax
	movd	%xmm4, %edx
	salq	$32, %rdx
	orq	%rdx, %rax
	movq	%rax, %xmm0
	ret
	.cfi_endproc
.LFE3636:
	.size	_Zpl6float4S_, .-_Zpl6float4S_
	.globl	_Z8genReal3fff
	.type	_Z8genReal3fff, @function
_Z8genReal3fff:
.LFB3637:
	.cfi_startproc
	endbr64
	movd	%xmm1, %edx
	movd	%xmm0, %eax
	salq	$32, %rdx
	orq	%rdx, %rax
	movd	%xmm2, %edx
	movd	%edx, %xmm1
	movq	%rax, %xmm0
	ret
	.cfi_endproc
.LFE3637:
	.size	_Z8genReal3fff, .-_Z8genReal3fff
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3638:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movabsq	$4728779609831636992, %rax
	movq	%rax, %xmm0
	movl	$1106247680, %eax
	movq	%rax, %xmm1
	call	_Z4puts6float4
	movabsq	$4795207704354750464, %rax
	movq	%rax, %xmm0
	movl	$1114636288, %eax
	movq	%rax, %xmm1
	call	_Z4puts6float4
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3638:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3664:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3664:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream>
typedef float4 Real3;

void puts(Real3 v){
  std::cout << "(" << v.x << " " << v.y << " " << v.z << ")" << std::endl;
}

Real3 operator+(Real3 v1, Real3 v2){
  Real3 p;
  p.x = v1.x + v2.x;
  p.y = v1.y + v2.y;
  p.z = v1.z = v2.z;
  return p;
}

Real3 genReal3(float x, float y, float z){
  Real3 p;
  p.x = x;
  p.y = y;
  p.z = z;
  return p; 
}

int main(void){
  Real3 p = genReal3(10,20,30);

  puts(p);

  Real3 q = genReal3(40,50,60);
  
  puts(p+q);
  
  return 0;
}
  

	.text
	.file	"float4.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z4puts15HIP_vector_typeIfLj4EE # -- Begin function _Z4puts15HIP_vector_typeIfLj4EE
	.type	_Z4puts15HIP_vector_typeIfLj4EE,@function
_Z4puts15HIP_vector_typeIfLj4EE:        # @_Z4puts15HIP_vector_typeIfLj4EE
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movsd	%xmm1, 16(%rsp)                 # 8-byte Spill
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	8(%rsp), %xmm0                  # 8-byte Folded Reload
                                        # xmm0 = mem[0],zero
	movq	%xmm0, %r14
	movd	%r14d, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	shrq	$32, %r14
	movd	%r14d, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	16(%rsp), %xmm0                 # 8-byte Folded Reload
                                        # xmm0 = mem[0],zero
	movq	%xmm0, %rax
	movd	%eax, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.2, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end0:
	.size	_Z4puts15HIP_vector_typeIfLj4EE, .Lfunc_end0-_Z4puts15HIP_vector_typeIfLj4EE
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Zpl15HIP_vector_typeIfLj4EES0_
.LCPI1_0:
	.quad	0x00000000ffffffff              # double 2.1219957904712067E-314
	.text
	.globl	_Zpl15HIP_vector_typeIfLj4EES0_
	.type	_Zpl15HIP_vector_typeIfLj4EES0_,@function
_Zpl15HIP_vector_typeIfLj4EES0_:        # @_Zpl15HIP_vector_typeIfLj4EES0_
	.cfi_startproc
# %bb.0:
	movq	%xmm0, %rax
	movd	%eax, %xmm0
	movq	%xmm2, %rcx
	movd	%ecx, %xmm1
	addss	%xmm0, %xmm1
	movss	%xmm1, -8(%rsp)
	shrq	$32, %rax
	movd	%eax, %xmm0
	shrq	$32, %rcx
	movd	%ecx, %xmm1
	addss	%xmm0, %xmm1
	movss	%xmm1, -4(%rsp)
	movsd	.LCPI1_0(%rip), %xmm1           # xmm1 = mem[0],zero
	andps	%xmm3, %xmm1
	movsd	-8(%rsp), %xmm0                 # xmm0 = mem[0],zero
	retq
.Lfunc_end1:
	.size	_Zpl15HIP_vector_typeIfLj4EES0_, .Lfunc_end1-_Zpl15HIP_vector_typeIfLj4EES0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z8genReal3fff                  # -- Begin function _Z8genReal3fff
	.type	_Z8genReal3fff,@function
_Z8genReal3fff:                         # @_Z8genReal3fff
	.cfi_startproc
# %bb.0:
	movss	%xmm0, -24(%rsp)
	movss	%xmm1, -20(%rsp)
	movss	%xmm2, -8(%rsp)
	movsd	-24(%rsp), %xmm0                # xmm0 = mem[0],zero
	movsd	-8(%rsp), %xmm1                 # xmm1 = mem[0],zero
	retq
.Lfunc_end2:
	.size	_Z8genReal3fff, .Lfunc_end2-_Z8genReal3fff
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI3_0:
	.long	0x42200000                      # float 40
.LCPI3_1:
	.long	0x42480000                      # float 50
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI3_2:
	.quad	0x0000000042700000              # double 5.5070349750880969E-315
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movabsq	$4728779609831636992, %rax      # imm = 0x41A0000041200000
	movq	%rax, (%rsp)
	movl	$1106247680, 16(%rsp)           # imm = 0x41F00000
	movsd	(%rsp), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movsd	16(%rsp), %xmm1                 # xmm1 = mem[0],zero
	callq	_Z4puts15HIP_vector_typeIfLj4EE
	movq	8(%rsp), %xmm0                  # 8-byte Folded Reload
                                        # xmm0 = mem[0],zero
	movq	%xmm0, %rax
	movd	%eax, %xmm0
	addss	.LCPI3_0(%rip), %xmm0
	movss	%xmm0, (%rsp)
	shrq	$32, %rax
	movd	%eax, %xmm0
	addss	.LCPI3_1(%rip), %xmm0
	movss	%xmm0, 4(%rsp)
	movsd	(%rsp), %xmm0                   # xmm0 = mem[0],zero
	movsd	.LCPI3_2(%rip), %xmm1           # xmm1 = mem[0],zero
	callq	_Z4puts15HIP_vector_typeIfLj4EE
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"("
	.size	.L.str, 2

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	" "
	.size	.L.str.1, 2

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	")"
	.size	.L.str.2, 2

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
