389 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; RUN: llc -mtriple=armv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16 | FileCheck %s --check-prefix=LE3; RUN: llc -mtriple=armebv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16 | FileCheck %s --check-prefix=BE4; RUN: llc -mtriple=armv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16,+bf16 | FileCheck %s --check-prefix=LE-BF165; RUN: llc -mtriple=armebv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16,+bf16 | FileCheck %s --check-prefix=BE-BF166 7;; Global ISel successfully generates code for some functions for little-endian8;; without +bf16, and falls back to SelectionDAG in all others.9; RUN: llc -mtriple=armv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefix=LE-GISEL10; RUN: llc -mtriple=armebv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefix=BE11; RUN: llc -mtriple=armv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16,+bf16 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefix=LE-BF1612; RUN: llc -mtriple=armebv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16,+bf16 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefix=BE-BF1613 14define arm_aapcscc bfloat @callee_soft_bfloat_in_reg(bfloat %f) {15; LE-LABEL: callee_soft_bfloat_in_reg:16; LE: @ %bb.0: @ %entry17; LE-NEXT: bx lr18;19; BE-LABEL: callee_soft_bfloat_in_reg:20; BE: @ %bb.0: @ %entry21; BE-NEXT: bx lr22;23; LE-BF16-LABEL: callee_soft_bfloat_in_reg:24; LE-BF16: @ %bb.0: @ %entry25; LE-BF16-NEXT: .pad #426; LE-BF16-NEXT: sub sp, #427; LE-BF16-NEXT: strh.w r0, [sp, #2]28; LE-BF16-NEXT: ldrh.w r0, [sp, #2]29; LE-BF16-NEXT: add sp, #430; LE-BF16-NEXT: bx lr31;32; BE-BF16-LABEL: callee_soft_bfloat_in_reg:33; BE-BF16: @ %bb.0: @ %entry34; BE-BF16-NEXT: .pad #435; BE-BF16-NEXT: sub sp, #436; BE-BF16-NEXT: strh.w r0, [sp, #2]37; BE-BF16-NEXT: ldrh.w r0, [sp, #2]38; BE-BF16-NEXT: add sp, #439; BE-BF16-NEXT: bx lr40;41; LE-GISEL-LABEL: callee_soft_bfloat_in_reg:42; LE-GISEL: @ %bb.0: @ %entry43; LE-GISEL-NEXT: bx lr44entry:45 ret bfloat %f46}47 48define void @caller_soft_bfloat_in_reg() {49; LE-LABEL: caller_soft_bfloat_in_reg:50; LE: @ %bb.0: @ %entry51; LE-NEXT: .save {r7, lr}52; LE-NEXT: push {r7, lr}53; LE-NEXT: mov.w r0, #1625654; LE-NEXT: bl callee_soft_bfloat_in_reg55; LE-NEXT: pop {r7, pc}56;57; BE-LABEL: caller_soft_bfloat_in_reg:58; BE: @ %bb.0: @ %entry59; BE-NEXT: .save {r7, lr}60; BE-NEXT: push {r7, lr}61; BE-NEXT: mov.w r0, #1625662; BE-NEXT: bl callee_soft_bfloat_in_reg63; BE-NEXT: pop {r7, pc}64;65; LE-BF16-LABEL: caller_soft_bfloat_in_reg:66; LE-BF16: @ %bb.0: @ %entry67; LE-BF16-NEXT: .save {r7, lr}68; LE-BF16-NEXT: push {r7, lr}69; LE-BF16-NEXT: mov.w r0, #1625670; LE-BF16-NEXT: bl callee_soft_bfloat_in_reg71; LE-BF16-NEXT: pop {r7, pc}72;73; BE-BF16-LABEL: caller_soft_bfloat_in_reg:74; BE-BF16: @ %bb.0: @ %entry75; BE-BF16-NEXT: .save {r7, lr}76; BE-BF16-NEXT: push {r7, lr}77; BE-BF16-NEXT: mov.w r0, #1625678; BE-BF16-NEXT: bl callee_soft_bfloat_in_reg79; BE-BF16-NEXT: pop {r7, pc}80;81; LE-GISEL-LABEL: caller_soft_bfloat_in_reg:82; LE-GISEL: @ %bb.0: @ %entry83; LE-GISEL-NEXT: .save {r7, lr}84; LE-GISEL-NEXT: push {r7, lr}85; LE-GISEL-NEXT: mov.w r0, #1625686; LE-GISEL-NEXT: bl callee_soft_bfloat_in_reg87; LE-GISEL-NEXT: pop {r7, pc}88entry:89 %ret = call arm_aapcscc bfloat @callee_soft_bfloat_in_reg(bfloat 1.0)90 ret void91}92 93define arm_aapcscc bfloat @callee_soft_bfloat_on_stack(float %r0, float %r1, float %r2, float %r3, bfloat %f) {94; LE-LABEL: callee_soft_bfloat_on_stack:95; LE: @ %bb.0: @ %entry96; LE-NEXT: ldr r0, [sp]97; LE-NEXT: bx lr98;99; BE-LABEL: callee_soft_bfloat_on_stack:100; BE: @ %bb.0: @ %entry101; BE-NEXT: ldr r0, [sp]102; BE-NEXT: bx lr103;104; LE-BF16-LABEL: callee_soft_bfloat_on_stack:105; LE-BF16: @ %bb.0: @ %entry106; LE-BF16-NEXT: ldrh.w r0, [sp]107; LE-BF16-NEXT: bx lr108;109; BE-BF16-LABEL: callee_soft_bfloat_on_stack:110; BE-BF16: @ %bb.0: @ %entry111; BE-BF16-NEXT: ldrh.w r0, [sp, #2]112; BE-BF16-NEXT: bx lr113;114; LE-GISEL-LABEL: callee_soft_bfloat_on_stack:115; LE-GISEL: @ %bb.0: @ %entry116; LE-GISEL-NEXT: mov r0, sp117; LE-GISEL-NEXT: ldr r0, [r0]118; LE-GISEL-NEXT: bx lr119entry:120 ret bfloat %f121}122 123define void @caller_soft_bfloat_on_stack() {124; LE-LABEL: caller_soft_bfloat_on_stack:125; LE: @ %bb.0: @ %entry126; LE-NEXT: .save {r7, lr}127; LE-NEXT: push {r7, lr}128; LE-NEXT: .pad #8129; LE-NEXT: sub sp, #8130; LE-NEXT: mov.w r0, #16256131; LE-NEXT: str r0, [sp]132; LE-NEXT: bl callee_soft_bfloat_on_stack133; LE-NEXT: add sp, #8134; LE-NEXT: pop {r7, pc}135;136; BE-LABEL: caller_soft_bfloat_on_stack:137; BE: @ %bb.0: @ %entry138; BE-NEXT: .save {r7, lr}139; BE-NEXT: push {r7, lr}140; BE-NEXT: .pad #8141; BE-NEXT: sub sp, #8142; BE-NEXT: mov.w r0, #16256143; BE-NEXT: str r0, [sp]144; BE-NEXT: bl callee_soft_bfloat_on_stack145; BE-NEXT: add sp, #8146; BE-NEXT: pop {r7, pc}147;148; LE-BF16-LABEL: caller_soft_bfloat_on_stack:149; LE-BF16: @ %bb.0: @ %entry150; LE-BF16-NEXT: .save {r7, lr}151; LE-BF16-NEXT: push {r7, lr}152; LE-BF16-NEXT: .pad #8153; LE-BF16-NEXT: sub sp, #8154; LE-BF16-NEXT: mov.w r0, #16256155; LE-BF16-NEXT: str r0, [sp]156; LE-BF16-NEXT: bl callee_soft_bfloat_on_stack157; LE-BF16-NEXT: add sp, #8158; LE-BF16-NEXT: pop {r7, pc}159;160; BE-BF16-LABEL: caller_soft_bfloat_on_stack:161; BE-BF16: @ %bb.0: @ %entry162; BE-BF16-NEXT: .save {r7, lr}163; BE-BF16-NEXT: push {r7, lr}164; BE-BF16-NEXT: .pad #8165; BE-BF16-NEXT: sub sp, #8166; BE-BF16-NEXT: mov.w r0, #16256167; BE-BF16-NEXT: str r0, [sp]168; BE-BF16-NEXT: bl callee_soft_bfloat_on_stack169; BE-BF16-NEXT: add sp, #8170; BE-BF16-NEXT: pop {r7, pc}171;172; LE-GISEL-LABEL: caller_soft_bfloat_on_stack:173; LE-GISEL: @ %bb.0: @ %entry174; LE-GISEL-NEXT: .save {r7, lr}175; LE-GISEL-NEXT: push {r7, lr}176; LE-GISEL-NEXT: .pad #8177; LE-GISEL-NEXT: sub sp, #8178; LE-GISEL-NEXT: mov.w r0, #16256179; LE-GISEL-NEXT: str r0, [sp]180; LE-GISEL-NEXT: bl callee_soft_bfloat_on_stack181; LE-GISEL-NEXT: add sp, #8182; LE-GISEL-NEXT: pop {r7, pc}183entry:184 %ret = call arm_aapcscc bfloat @callee_soft_bfloat_on_stack(float poison, float poison, float poison, float poison, bfloat 1.0)185 ret void186}187 188define arm_aapcs_vfpcc bfloat @callee_hard_bfloat_in_reg(bfloat %f) {189; LE-LABEL: callee_hard_bfloat_in_reg:190; LE: @ %bb.0: @ %entry191; LE-NEXT: bx lr192;193; BE-LABEL: callee_hard_bfloat_in_reg:194; BE: @ %bb.0: @ %entry195; BE-NEXT: bx lr196;197; LE-BF16-LABEL: callee_hard_bfloat_in_reg:198; LE-BF16: @ %bb.0: @ %entry199; LE-BF16-NEXT: .pad #4200; LE-BF16-NEXT: sub sp, #4201; LE-BF16-NEXT: vmov r0, s0202; LE-BF16-NEXT: strh.w r0, [sp, #2]203; LE-BF16-NEXT: ldrh.w r0, [sp, #2]204; LE-BF16-NEXT: vmov s0, r0205; LE-BF16-NEXT: add sp, #4206; LE-BF16-NEXT: bx lr207;208; BE-BF16-LABEL: callee_hard_bfloat_in_reg:209; BE-BF16: @ %bb.0: @ %entry210; BE-BF16-NEXT: .pad #4211; BE-BF16-NEXT: sub sp, #4212; BE-BF16-NEXT: vmov r0, s0213; BE-BF16-NEXT: strh.w r0, [sp, #2]214; BE-BF16-NEXT: ldrh.w r0, [sp, #2]215; BE-BF16-NEXT: vmov s0, r0216; BE-BF16-NEXT: add sp, #4217; BE-BF16-NEXT: bx lr218;219; LE-GISEL-LABEL: callee_hard_bfloat_in_reg:220; LE-GISEL: @ %bb.0: @ %entry221; LE-GISEL-NEXT: bx lr222entry:223 ret bfloat %f224}225 226define void @caller_hard_bfloat_in_reg() {227; LE-LABEL: caller_hard_bfloat_in_reg:228; LE: @ %bb.0: @ %entry229; LE-NEXT: .save {r7, lr}230; LE-NEXT: push {r7, lr}231; LE-NEXT: vldr s0, .LCPI5_0232; LE-NEXT: bl callee_hard_bfloat_in_reg233; LE-NEXT: pop {r7, pc}234; LE-NEXT: .p2align 2235; LE-NEXT: @ %bb.1:236; LE-NEXT: .LCPI5_0:237; LE-NEXT: .long 0x00003f80 @ float 2.27795078E-41238;239; BE-LABEL: caller_hard_bfloat_in_reg:240; BE: @ %bb.0: @ %entry241; BE-NEXT: .save {r7, lr}242; BE-NEXT: push {r7, lr}243; BE-NEXT: vldr s0, .LCPI5_0244; BE-NEXT: bl callee_hard_bfloat_in_reg245; BE-NEXT: pop {r7, pc}246; BE-NEXT: .p2align 2247; BE-NEXT: @ %bb.1:248; BE-NEXT: .LCPI5_0:249; BE-NEXT: .long 0x00003f80 @ float 2.27795078E-41250;251; LE-BF16-LABEL: caller_hard_bfloat_in_reg:252; LE-BF16: @ %bb.0: @ %entry253; LE-BF16-NEXT: .save {r7, lr}254; LE-BF16-NEXT: push {r7, lr}255; LE-BF16-NEXT: vldr s0, .LCPI5_0256; LE-BF16-NEXT: bl callee_hard_bfloat_in_reg257; LE-BF16-NEXT: pop {r7, pc}258; LE-BF16-NEXT: .p2align 2259; LE-BF16-NEXT: @ %bb.1:260; LE-BF16-NEXT: .LCPI5_0:261; LE-BF16-NEXT: .long 0x00003f80 @ float 2.27795078E-41262;263; BE-BF16-LABEL: caller_hard_bfloat_in_reg:264; BE-BF16: @ %bb.0: @ %entry265; BE-BF16-NEXT: .save {r7, lr}266; BE-BF16-NEXT: push {r7, lr}267; BE-BF16-NEXT: vldr s0, .LCPI5_0268; BE-BF16-NEXT: bl callee_hard_bfloat_in_reg269; BE-BF16-NEXT: pop {r7, pc}270; BE-BF16-NEXT: .p2align 2271; BE-BF16-NEXT: @ %bb.1:272; BE-BF16-NEXT: .LCPI5_0:273; BE-BF16-NEXT: .long 0x00003f80 @ float 2.27795078E-41274;275; LE-GISEL-LABEL: caller_hard_bfloat_in_reg:276; LE-GISEL: @ %bb.0: @ %entry277; LE-GISEL-NEXT: .save {r7, lr}278; LE-GISEL-NEXT: push {r7, lr}279; LE-GISEL-NEXT: vldr s0, .LCPI5_0280; LE-GISEL-NEXT: bl callee_hard_bfloat_in_reg281; LE-GISEL-NEXT: pop {r7, pc}282; LE-GISEL-NEXT: .p2align 2283; LE-GISEL-NEXT: @ %bb.1:284; LE-GISEL-NEXT: .LCPI5_0:285; LE-GISEL-NEXT: .long 0x00003f80 @ float 2.27795078E-41286entry:287 %ret = call arm_aapcs_vfpcc bfloat @callee_hard_bfloat_in_reg(bfloat 1.0)288 ret void289}290 291define arm_aapcs_vfpcc bfloat @callee_hard_bfloat_on_stack(float %s0, float %s1, float %s2, float %s3, float %s4, float %s5, float %s6, float %s7,float %s8, float %s9, float %s10, float %s11, float %s12, float %s13, float %s14, float %s15, bfloat %f) {292; LE-LABEL: callee_hard_bfloat_on_stack:293; LE: @ %bb.0: @ %entry294; LE-NEXT: vldr s0, [sp]295; LE-NEXT: bx lr296;297; BE-LABEL: callee_hard_bfloat_on_stack:298; BE: @ %bb.0: @ %entry299; BE-NEXT: vldr s0, [sp]300; BE-NEXT: bx lr301;302; LE-BF16-LABEL: callee_hard_bfloat_on_stack:303; LE-BF16: @ %bb.0: @ %entry304; LE-BF16-NEXT: ldrh.w r0, [sp]305; LE-BF16-NEXT: vmov s0, r0306; LE-BF16-NEXT: bx lr307;308; BE-BF16-LABEL: callee_hard_bfloat_on_stack:309; BE-BF16: @ %bb.0: @ %entry310; BE-BF16-NEXT: ldrh.w r0, [sp, #2]311; BE-BF16-NEXT: vmov s0, r0312; BE-BF16-NEXT: bx lr313;314; LE-GISEL-LABEL: callee_hard_bfloat_on_stack:315; LE-GISEL: @ %bb.0: @ %entry316; LE-GISEL-NEXT: mov r0, sp317; LE-GISEL-NEXT: ldr r0, [r0]318; LE-GISEL-NEXT: vmov s0, r0319; LE-GISEL-NEXT: bx lr320entry:321 ret bfloat %f322}323 324 325define void @caller_hard_bfloat_on_stack() {326; LE-LABEL: caller_hard_bfloat_on_stack:327; LE: @ %bb.0: @ %entry328; LE-NEXT: .save {r7, lr}329; LE-NEXT: push {r7, lr}330; LE-NEXT: .pad #8331; LE-NEXT: sub sp, #8332; LE-NEXT: mov.w r0, #16256333; LE-NEXT: str r0, [sp]334; LE-NEXT: bl callee_hard_bfloat_on_stack335; LE-NEXT: add sp, #8336; LE-NEXT: pop {r7, pc}337;338; BE-LABEL: caller_hard_bfloat_on_stack:339; BE: @ %bb.0: @ %entry340; BE-NEXT: .save {r7, lr}341; BE-NEXT: push {r7, lr}342; BE-NEXT: .pad #8343; BE-NEXT: sub sp, #8344; BE-NEXT: mov.w r0, #16256345; BE-NEXT: str r0, [sp]346; BE-NEXT: bl callee_hard_bfloat_on_stack347; BE-NEXT: add sp, #8348; BE-NEXT: pop {r7, pc}349;350; LE-BF16-LABEL: caller_hard_bfloat_on_stack:351; LE-BF16: @ %bb.0: @ %entry352; LE-BF16-NEXT: .save {r7, lr}353; LE-BF16-NEXT: push {r7, lr}354; LE-BF16-NEXT: .pad #8355; LE-BF16-NEXT: sub sp, #8356; LE-BF16-NEXT: mov.w r0, #16256357; LE-BF16-NEXT: str r0, [sp]358; LE-BF16-NEXT: bl callee_hard_bfloat_on_stack359; LE-BF16-NEXT: add sp, #8360; LE-BF16-NEXT: pop {r7, pc}361;362; BE-BF16-LABEL: caller_hard_bfloat_on_stack:363; BE-BF16: @ %bb.0: @ %entry364; BE-BF16-NEXT: .save {r7, lr}365; BE-BF16-NEXT: push {r7, lr}366; BE-BF16-NEXT: .pad #8367; BE-BF16-NEXT: sub sp, #8368; BE-BF16-NEXT: mov.w r0, #16256369; BE-BF16-NEXT: str r0, [sp]370; BE-BF16-NEXT: bl callee_hard_bfloat_on_stack371; BE-BF16-NEXT: add sp, #8372; BE-BF16-NEXT: pop {r7, pc}373;374; LE-GISEL-LABEL: caller_hard_bfloat_on_stack:375; LE-GISEL: @ %bb.0: @ %entry376; LE-GISEL-NEXT: .save {r7, lr}377; LE-GISEL-NEXT: push {r7, lr}378; LE-GISEL-NEXT: .pad #8379; LE-GISEL-NEXT: sub sp, #8380; LE-GISEL-NEXT: mov.w r0, #16256381; LE-GISEL-NEXT: str r0, [sp]382; LE-GISEL-NEXT: bl callee_hard_bfloat_on_stack383; LE-GISEL-NEXT: add sp, #8384; LE-GISEL-NEXT: pop {r7, pc}385entry:386 %ret = call arm_aapcs_vfpcc bfloat @callee_hard_bfloat_on_stack(float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, bfloat 1.0)387 ret void388}389