brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 40211f2 Raw
77 lines · plain
1; RUN: llc -mtriple=hexagon < %s | FileCheck %s2 3; This test validates the following facts for half-precision floating point4; conversions.5; Generate correct libcall names for conversion from fp16 to fp32.6; (__extendhfsf2).7;  The extension from fp16 to fp64 is implicitly handled by __extendhfsf2 and convert_sf2d.8; (fp16->fp32->fp64).9; Generate correcct libcall names for conversion from fp32/fp64 to fp1610; (__truncsfhf2 and __truncdfhf2)11; Verify that we generate loads and stores of halfword.12 13; Validate that we generate correct lib calls to convert fp1614 15;CHECK-LABEL: @test116;CHECK: jump __extendhfsf217;CHECK: r0 = memuh18define dso_local float @test1(ptr nocapture readonly %a) local_unnamed_addr #0 {19entry:20  %0 = load i16, ptr %a, align 221  %1 = tail call float @llvm.convert.from.fp16.f32(i16 %0)22  ret float %123}24 25;CHECK-LABEL: @test226;CHECK: call __extendhfsf227;CHECK: r0 = memuh28;CHECK: convert_sf2d29define dso_local double @test2(ptr nocapture readonly %a) local_unnamed_addr #0 {30entry:31  %0 = load i16, ptr %a, align 232  %1 = tail call double @llvm.convert.from.fp16.f64(i16 %0)33  ret double %134}35 36;CHECK-LABEL: @test337;CHECK: call __truncsfhf238;CHECK: memh{{.*}}= r039define dso_local void @test3(float %src, ptr nocapture %dst) local_unnamed_addr #0 {40entry:41  %0 = tail call i16 @llvm.convert.to.fp16.f32(float %src)42  store i16 %0, ptr %dst, align 243  ret void44}45 46;CHECK-LABEL: @test447;CHECK: call __truncdfhf248;CHECK: memh{{.*}}= r049define dso_local void @test4(double %src, ptr nocapture %dst) local_unnamed_addr #0 {50entry:51  %0 = tail call i16 @llvm.convert.to.fp16.f64(double %src)52  store i16 %0, ptr %dst, align 253  ret void54}55 56;CHECK-LABEL: @test557;CHECK: call __extendhfsf258;CHECK: call __extendhfsf259;CHECK: sfadd60define dso_local float @test5(ptr nocapture readonly %a, ptr nocapture readonly %b) local_unnamed_addr #0 {61entry:62  %0 = load i16, ptr %a, align 263  %1 = tail call float @llvm.convert.from.fp16.f32(i16 %0)64  %2 = load i16, ptr %b, align 265  %3 = tail call float @llvm.convert.from.fp16.f32(i16 %2)66  %add = fadd float %1, %367  ret float %add68}69 70declare float @llvm.convert.from.fp16.f32(i16) #171declare double @llvm.convert.from.fp16.f64(i16) #172declare i16 @llvm.convert.to.fp16.f32(float) #173declare i16 @llvm.convert.to.fp16.f64(double) #174 75attributes #0 = { nounwind readonly }76attributes #1 = { nounwind readnone }77