blob: 67925ebd82b655832a7b07a73e8426ce9146232f [file] [log] [blame]
Tom Stellard49f8bfd2015-01-06 18:00:21 +00001; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
Marek Olsak75170772015-01-27 17:27:15 +00002; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
Matt Arsenaultb0df9252014-07-10 03:22:20 +00003
Tim Northoverfd7e4242014-07-17 10:51:23 +00004declare i16 @llvm.convert.to.fp16.f32(float) nounwind readnone
Matt Arsenaultb0df9252014-07-10 03:22:20 +00005
Tom Stellard79243d92014-10-01 17:15:17 +00006; SI-LABEL: {{^}}test_convert_fp32_to_fp16:
Tom Stellard326d6ec2014-11-05 14:50:53 +00007; SI: buffer_load_dword [[VAL:v[0-9]+]]
8; SI: v_cvt_f16_f32_e32 [[RESULT:v[0-9]+]], [[VAL]]
9; SI: buffer_store_short [[RESULT]]
Tim Northover12817862014-07-18 08:43:30 +000010define void @test_convert_fp32_to_fp16(i16 addrspace(1)* noalias %out, float addrspace(1)* noalias %in) nounwind {
David Blaikiea79ac142015-02-27 21:17:42 +000011 %val = load float, float addrspace(1)* %in, align 4
Tim Northoverfd7e4242014-07-17 10:51:23 +000012 %cvt = call i16 @llvm.convert.to.fp16.f32(float %val) nounwind readnone
Matt Arsenaultb0df9252014-07-10 03:22:20 +000013 store i16 %cvt, i16 addrspace(1)* %out, align 2
14 ret void
15}