brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.3 KiB · 081b1ce Raw
182 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-linux-gnu -mattr=+avx2 | FileCheck %s --check-prefixes=X644; RUN: llc < %s -mtriple=x86_64-linux-gnu -mattr=+avx512bf16,+avx512vl | FileCheck %s --check-prefixes=X645 6@a = global bfloat 0xR0000, align 27@b = global bfloat 0xR0000, align 28@c = global bfloat 0xR0000, align 29 10define float @bfloat_to_float() strictfp {11; X86-LABEL: bfloat_to_float:12; X86:       # %bb.0:13; X86-NEXT:    subl $12, %esp14; X86-NEXT:    .cfi_def_cfa_offset 1615; X86-NEXT:    movzwl a, %eax16; X86-NEXT:    movl %eax, (%esp)17; X86-NEXT:    calll __extendbfsf218; X86-NEXT:    addl $12, %esp19; X86-NEXT:    .cfi_def_cfa_offset 420; X86-NEXT:    retl21;22; X64-LABEL: bfloat_to_float:23; X64:       # %bb.0:24; X64-NEXT:    pushq %rax25; X64-NEXT:    .cfi_def_cfa_offset 1626; X64-NEXT:    movq a@GOTPCREL(%rip), %rax27; X64-NEXT:    movzwl (%rax), %edi28; X64-NEXT:    callq __extendbfsf2@PLT29; X64-NEXT:    popq %rax30; X64-NEXT:    .cfi_def_cfa_offset 831; X64-NEXT:    retq32  %1 = load bfloat, ptr @a, align 233  %2 = tail call float @llvm.experimental.constrained.fpext.f32.bfloat(bfloat %1, metadata !"fpexcept.strict") #034  ret float %235}36 37define double @bfloat_to_double() strictfp {38; X86-LABEL: bfloat_to_double:39; X86:       # %bb.0:40; X86-NEXT:    subl $12, %esp41; X86-NEXT:    .cfi_def_cfa_offset 1642; X86-NEXT:    movzwl a, %eax43; X86-NEXT:    movl %eax, (%esp)44; X86-NEXT:    calll __extendbfsf245; X86-NEXT:    addl $12, %esp46; X86-NEXT:    .cfi_def_cfa_offset 447; X86-NEXT:    retl48;49; X64-LABEL: bfloat_to_double:50; X64:       # %bb.0:51; X64-NEXT:    pushq %rax52; X64-NEXT:    .cfi_def_cfa_offset 1653; X64-NEXT:    movq a@GOTPCREL(%rip), %rax54; X64-NEXT:    movzwl (%rax), %edi55; X64-NEXT:    callq __extendbfsf2@PLT56; X64-NEXT:    vcvtss2sd %xmm0, %xmm0, %xmm057; X64-NEXT:    popq %rax58; X64-NEXT:    .cfi_def_cfa_offset 859; X64-NEXT:    retq60  %1 = load bfloat, ptr @a, align 261  %2 = tail call double @llvm.experimental.constrained.fpext.f64.bfloat(bfloat %1, metadata !"fpexcept.strict") #062  ret double %263}64 65define void @float_to_bfloat(float %0) strictfp {66; X86-LABEL: float_to_bfloat:67; X86:       # %bb.0:68; X86-NEXT:    subl $12, %esp69; X86-NEXT:    .cfi_def_cfa_offset 1670; X86-NEXT:    flds {{[0-9]+}}(%esp)71; X86-NEXT:    fstps (%esp)72; X86-NEXT:    wait73; X86-NEXT:    calll __truncsfbf274; X86-NEXT:    movw %ax, a75; X86-NEXT:    addl $12, %esp76; X86-NEXT:    .cfi_def_cfa_offset 477; X86-NEXT:    retl78;79; X64-LABEL: float_to_bfloat:80; X64:       # %bb.0:81; X64-NEXT:    pushq %rax82; X64-NEXT:    .cfi_def_cfa_offset 1683; X64-NEXT:    callq __truncsfbf2@PLT84; X64-NEXT:    movq a@GOTPCREL(%rip), %rcx85; X64-NEXT:    movw %ax, (%rcx)86; X64-NEXT:    popq %rax87; X64-NEXT:    .cfi_def_cfa_offset 888; X64-NEXT:    retq89  %2 = tail call bfloat @llvm.experimental.constrained.fptrunc.bf16.f32(float %0, metadata !"round.tonearest", metadata !"fpexcept.strict") #090  store bfloat %2, ptr @a, align 291  ret void92}93 94define void @double_to_bfloat(double %0) strictfp {95; X86-LABEL: double_to_bfloat:96; X86:       # %bb.0:97; X86-NEXT:    subl $12, %esp98; X86-NEXT:    .cfi_def_cfa_offset 1699; X86-NEXT:    fldl {{[0-9]+}}(%esp)100; X86-NEXT:    fstpl (%esp)101; X86-NEXT:    wait102; X86-NEXT:    calll __truncdfbf2103; X86-NEXT:    movw %ax, a104; X86-NEXT:    addl $12, %esp105; X86-NEXT:    .cfi_def_cfa_offset 4106; X86-NEXT:    retl107;108; X64-LABEL: double_to_bfloat:109; X64:       # %bb.0:110; X64-NEXT:    pushq %rax111; X64-NEXT:    .cfi_def_cfa_offset 16112; X64-NEXT:    callq __truncdfbf2@PLT113; X64-NEXT:    movq a@GOTPCREL(%rip), %rcx114; X64-NEXT:    movw %ax, (%rcx)115; X64-NEXT:    popq %rax116; X64-NEXT:    .cfi_def_cfa_offset 8117; X64-NEXT:    retq118  %2 = tail call bfloat @llvm.experimental.constrained.fptrunc.bf16.f64(double %0, metadata !"round.tonearest", metadata !"fpexcept.strict") #0119  store bfloat %2, ptr @a, align 2120  ret void121}122 123define void @add() strictfp {124; X86-LABEL: add:125; X86:       # %bb.0:126; X86-NEXT:    subl $12, %esp127; X86-NEXT:    .cfi_def_cfa_offset 16128; X86-NEXT:    movzwl a, %eax129; X86-NEXT:    movl %eax, (%esp)130; X86-NEXT:    calll __extendbfsf2131; X86-NEXT:    fstps {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill132; X86-NEXT:    wait133; X86-NEXT:    movzwl b, %eax134; X86-NEXT:    movl %eax, (%esp)135; X86-NEXT:    calll __extendbfsf2136; X86-NEXT:    flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload137; X86-NEXT:    faddp %st, %st(1)138; X86-NEXT:    fstps (%esp)139; X86-NEXT:    wait140; X86-NEXT:    calll __truncsfbf2141; X86-NEXT:    movw %ax, c142; X86-NEXT:    addl $12, %esp143; X86-NEXT:    .cfi_def_cfa_offset 4144; X86-NEXT:    retl145;146; X64-LABEL: add:147; X64:       # %bb.0:148; X64-NEXT:    pushq %rax149; X64-NEXT:    .cfi_def_cfa_offset 16150; X64-NEXT:    movq a@GOTPCREL(%rip), %rax151; X64-NEXT:    movzwl (%rax), %edi152; X64-NEXT:    callq __extendbfsf2@PLT153; X64-NEXT:    vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill154; X64-NEXT:    movq b@GOTPCREL(%rip), %rax155; X64-NEXT:    movzwl (%rax), %edi156; X64-NEXT:    callq __extendbfsf2@PLT157; X64-NEXT:    vaddss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 4-byte Folded Reload158; X64-NEXT:    callq __truncsfbf2@PLT159; X64-NEXT:    movq c@GOTPCREL(%rip), %rcx160; X64-NEXT:    movw %ax, (%rcx)161; X64-NEXT:    popq %rax162; X64-NEXT:    .cfi_def_cfa_offset 8163; X64-NEXT:    retq164  %1 = load bfloat, ptr @a, align 2165  %2 = tail call float @llvm.experimental.constrained.fpext.f32.bf16(bfloat %1, metadata !"fpexcept.strict") #0166  %3 = load bfloat, ptr @b, align 2167  %4 = tail call float @llvm.experimental.constrained.fpext.f32.bf16(bfloat %3, metadata !"fpexcept.strict") #0168  %5 = tail call float @llvm.experimental.constrained.fadd.f32(float %2, float %4, metadata !"round.tonearest", metadata !"fpexcept.strict") #0169  %6 = tail call bfloat @llvm.experimental.constrained.fptrunc.bf16.f32(float %5, metadata !"round.tonearest", metadata !"fpexcept.strict") #0170  store bfloat %6, ptr @c, align 2171  ret void172}173 174declare float @llvm.experimental.constrained.fpext.f32.bf16(bfloat, metadata)175declare double @llvm.experimental.constrained.fpext.f64.bf16(bfloat, metadata)176declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata)177declare bfloat @llvm.experimental.constrained.fptrunc.bf16.f32(float, metadata, metadata)178declare bfloat @llvm.experimental.constrained.fptrunc.bf16.f64(double, metadata, metadata)179 180attributes #0 = { strictfp }181 182