brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.6 KiB · 8dbbc57 Raw
172 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=-avx512fp16 | FileCheck %s -check-prefix=LIBCALL3; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512fp16 | FileCheck %s -check-prefix=FP164 5define void @test1(float %src, ptr %dest) {6; LIBCALL-LABEL: test1:7; LIBCALL:       # %bb.0:8; LIBCALL-NEXT:    pushq %rbx9; LIBCALL-NEXT:    .cfi_def_cfa_offset 1610; LIBCALL-NEXT:    .cfi_offset %rbx, -1611; LIBCALL-NEXT:    movq %rdi, %rbx12; LIBCALL-NEXT:    callq __truncsfhf2@PLT13; LIBCALL-NEXT:    pextrw $0, %xmm0, %eax14; LIBCALL-NEXT:    movw %ax, (%rbx)15; LIBCALL-NEXT:    popq %rbx16; LIBCALL-NEXT:    .cfi_def_cfa_offset 817; LIBCALL-NEXT:    retq18;19; FP16-LABEL: test1:20; FP16:       # %bb.0:21; FP16-NEXT:    vcvtss2sh %xmm0, %xmm0, %xmm022; FP16-NEXT:    vmovsh %xmm0, (%rdi)23; FP16-NEXT:    retq24  %1 = tail call i16 @llvm.convert.to.fp16.f32(float %src)25  store i16 %1, ptr %dest, align 226  ret void27}28 29define float @test2(ptr nocapture %src) {30; LIBCALL-LABEL: test2:31; LIBCALL:       # %bb.0:32; LIBCALL-NEXT:    pinsrw $0, (%rdi), %xmm033; LIBCALL-NEXT:    jmp __extendhfsf2@PLT # TAILCALL34;35; FP16-LABEL: test2:36; FP16:       # %bb.0:37; FP16-NEXT:    vmovsh {{.*#+}} xmm0 = mem[0],zero,zero,zero,zero,zero,zero,zero38; FP16-NEXT:    vcvtsh2ss %xmm0, %xmm0, %xmm039; FP16-NEXT:    retq40  %1 = load i16, ptr %src, align 241  %2 = tail call float @llvm.convert.from.fp16.f32(i16 %1)42  ret float %243}44 45define float @test3(float %src) nounwind uwtable readnone {46; LIBCALL-LABEL: test3:47; LIBCALL:       # %bb.0:48; LIBCALL-NEXT:    pushq %rax49; LIBCALL-NEXT:    .cfi_def_cfa_offset 1650; LIBCALL-NEXT:    callq __truncsfhf2@PLT51; LIBCALL-NEXT:    popq %rax52; LIBCALL-NEXT:    .cfi_def_cfa_offset 853; LIBCALL-NEXT:    jmp __extendhfsf2@PLT # TAILCALL54;55; FP16-LABEL: test3:56; FP16:       # %bb.0:57; FP16-NEXT:    vcvtss2sh %xmm0, %xmm0, %xmm058; FP16-NEXT:    vcvtsh2ss %xmm0, %xmm0, %xmm059; FP16-NEXT:    retq60  %1 = tail call i16 @llvm.convert.to.fp16.f32(float %src)61  %2 = tail call float @llvm.convert.from.fp16.f32(i16 %1)62  ret float %263}64 65; FIXME: Should it be __extendhfdf2?66define double @test4(ptr nocapture %src) {67; LIBCALL-LABEL: test4:68; LIBCALL:       # %bb.0:69; LIBCALL-NEXT:    pushq %rax70; LIBCALL-NEXT:    .cfi_def_cfa_offset 1671; LIBCALL-NEXT:    pinsrw $0, (%rdi), %xmm072; LIBCALL-NEXT:    callq __extendhfsf2@PLT73; LIBCALL-NEXT:    cvtss2sd %xmm0, %xmm074; LIBCALL-NEXT:    popq %rax75; LIBCALL-NEXT:    .cfi_def_cfa_offset 876; LIBCALL-NEXT:    retq77;78; FP16-LABEL: test4:79; FP16:       # %bb.0:80; FP16-NEXT:    vmovsh {{.*#+}} xmm0 = mem[0],zero,zero,zero,zero,zero,zero,zero81; FP16-NEXT:    vcvtsh2sd %xmm0, %xmm0, %xmm082; FP16-NEXT:    retq83  %1 = load i16, ptr %src, align 284  %2 = tail call double @llvm.convert.from.fp16.f64(i16 %1)85  ret double %286}87 88define i16 @test5(double %src) {89; LIBCALL-LABEL: test5:90; LIBCALL:       # %bb.0:91; LIBCALL-NEXT:    pushq %rax92; LIBCALL-NEXT:    .cfi_def_cfa_offset 1693; LIBCALL-NEXT:    callq __truncdfhf2@PLT94; LIBCALL-NEXT:    pextrw $0, %xmm0, %eax95; LIBCALL-NEXT:    # kill: def $ax killed $ax killed $eax96; LIBCALL-NEXT:    popq %rcx97; LIBCALL-NEXT:    .cfi_def_cfa_offset 898; LIBCALL-NEXT:    retq99;100; FP16-LABEL: test5:101; FP16:       # %bb.0:102; FP16-NEXT:    vcvtsd2sh %xmm0, %xmm0, %xmm0103; FP16-NEXT:    vmovw %xmm0, %eax104; FP16-NEXT:    # kill: def $ax killed $ax killed $eax105; FP16-NEXT:    retq106  %val = tail call i16 @llvm.convert.to.fp16.f64(double %src)107  ret i16 %val108}109 110; FIXME: Should it be __extendhfxf2?111define x86_fp80 @test6(ptr nocapture %src) {112; LIBCALL-LABEL: test6:113; LIBCALL:       # %bb.0:114; LIBCALL-NEXT:    pushq %rax115; LIBCALL-NEXT:    .cfi_def_cfa_offset 16116; LIBCALL-NEXT:    pinsrw $0, (%rdi), %xmm0117; LIBCALL-NEXT:    callq __extendhfxf2@PLT118; LIBCALL-NEXT:    popq %rax119; LIBCALL-NEXT:    .cfi_def_cfa_offset 8120; LIBCALL-NEXT:    retq121;122; FP16-LABEL: test6:123; FP16:       # %bb.0:124; FP16-NEXT:    pushq %rax125; FP16-NEXT:    .cfi_def_cfa_offset 16126; FP16-NEXT:    vmovsh {{.*#+}} xmm0 = mem[0],zero,zero,zero,zero,zero,zero,zero127; FP16-NEXT:    callq __extendhfxf2@PLT128; FP16-NEXT:    popq %rax129; FP16-NEXT:    .cfi_def_cfa_offset 8130; FP16-NEXT:    retq131  %1 = load i16, ptr %src, align 2132  %2 = tail call x86_fp80 @llvm.convert.from.fp16.f80(i16 %1)133  ret x86_fp80 %2134}135 136define i16 @test7(x86_fp80 %src) {137; LIBCALL-LABEL: test7:138; LIBCALL:       # %bb.0:139; LIBCALL-NEXT:    subq $24, %rsp140; LIBCALL-NEXT:    .cfi_def_cfa_offset 32141; LIBCALL-NEXT:    fldt {{[0-9]+}}(%rsp)142; LIBCALL-NEXT:    fstpt (%rsp)143; LIBCALL-NEXT:    callq __truncxfhf2@PLT144; LIBCALL-NEXT:    pextrw $0, %xmm0, %eax145; LIBCALL-NEXT:    # kill: def $ax killed $ax killed $eax146; LIBCALL-NEXT:    addq $24, %rsp147; LIBCALL-NEXT:    .cfi_def_cfa_offset 8148; LIBCALL-NEXT:    retq149;150; FP16-LABEL: test7:151; FP16:       # %bb.0:152; FP16-NEXT:    subq $24, %rsp153; FP16-NEXT:    .cfi_def_cfa_offset 32154; FP16-NEXT:    fldt {{[0-9]+}}(%rsp)155; FP16-NEXT:    fstpt (%rsp)156; FP16-NEXT:    callq __truncxfhf2@PLT157; FP16-NEXT:    vmovw %xmm0, %eax158; FP16-NEXT:    # kill: def $ax killed $ax killed $eax159; FP16-NEXT:    addq $24, %rsp160; FP16-NEXT:    .cfi_def_cfa_offset 8161; FP16-NEXT:    retq162  %val = tail call i16 @llvm.convert.to.fp16.f80(x86_fp80 %src)163  ret i16 %val164}165 166declare float @llvm.convert.from.fp16.f32(i16) nounwind readnone167declare i16 @llvm.convert.to.fp16.f32(float) nounwind readnone168declare double @llvm.convert.from.fp16.f64(i16) nounwind readnone169declare i16 @llvm.convert.to.fp16.f64(double) nounwind readnone170declare x86_fp80 @llvm.convert.from.fp16.f80(i16) nounwind readnone171declare i16 @llvm.convert.to.fp16.f80(x86_fp80) nounwind readnone172