brintos

brintos / llvm-project-archived public Read only

0
0
Text · 13.3 KiB · f05f6ab Raw
273 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=riscv32 -mattr=+v,+d -O0 < %s \3; RUN:    | FileCheck --check-prefix=SPILL-O0 %s4; RUN: llc -mtriple=riscv32 -mattr=+v,+d -O2 < %s \5; RUN:    | FileCheck --check-prefix=SPILL-O2 %s6; RUN: llc -mtriple=riscv32 -mattr=+v,+d,+zcmp -O2 < %s \7; RUN:    | FileCheck --check-prefix=SPILL-O2-ZCMP %s8; RUN: llc -mtriple=riscv32 -mattr=+v,+d,+prefer-vsetvli-over-read-vlenb -O0 < %s \9; RUN:    | FileCheck --check-prefix=SPILL-O0-VSETVLI %s10; RUN: llc -mtriple=riscv32 -mattr=+v,+d,+prefer-vsetvli-over-read-vlenb -O2 < %s \11; RUN:    | FileCheck --check-prefix=SPILL-O2-VSETVLI %s12; RUN: llc -mtriple=riscv32 -mattr=+v,+d,+zcmp,+prefer-vsetvli-over-read-vlenb -O2 < %s \13; RUN:    | FileCheck --check-prefix=SPILL-O2-ZCMP-VSETVLI %s14 15@.str = private unnamed_addr constant [6 x i8] c"hello\00", align 116 17define <vscale x 1 x double> @foo(<vscale x 1 x double> %a, <vscale x 1 x double> %b, <vscale x 1 x double> %c, i32 %gvl)18; SPILL-O0-LABEL: foo:19; SPILL-O0:       # %bb.0:20; SPILL-O0-NEXT:    addi sp, sp, -3221; SPILL-O0-NEXT:    .cfi_def_cfa_offset 3222; SPILL-O0-NEXT:    sw ra, 28(sp) # 4-byte Folded Spill23; SPILL-O0-NEXT:    .cfi_offset ra, -424; SPILL-O0-NEXT:    csrr a1, vlenb25; SPILL-O0-NEXT:    slli a1, a1, 126; SPILL-O0-NEXT:    sub sp, sp, a127; SPILL-O0-NEXT:    .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x20, 0x22, 0x11, 0x02, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 32 + 2 * vlenb28; SPILL-O0-NEXT:    sw a0, 8(sp) # 4-byte Folded Spill29; SPILL-O0-NEXT:    vsetivli zero, 1, e8, m1, ta, ma30; SPILL-O0-NEXT:    vmv1r.v v10, v931; SPILL-O0-NEXT:    vmv1r.v v9, v832; SPILL-O0-NEXT:    csrr a1, vlenb33; SPILL-O0-NEXT:    add a1, sp, a134; SPILL-O0-NEXT:    addi a1, a1, 1635; SPILL-O0-NEXT:    vs1r.v v9, (a1) # vscale x 8-byte Folded Spill36; SPILL-O0-NEXT:    # implicit-def: $v837; SPILL-O0-NEXT:    vsetvli zero, a0, e64, m1, tu, ma38; SPILL-O0-NEXT:    vfadd.vv v8, v9, v1039; SPILL-O0-NEXT:    addi a0, sp, 1640; SPILL-O0-NEXT:    vs1r.v v8, (a0) # vscale x 8-byte Folded Spill41; SPILL-O0-NEXT:    lui a0, %hi(.L.str)42; SPILL-O0-NEXT:    addi a0, a0, %lo(.L.str)43; SPILL-O0-NEXT:    call puts44; SPILL-O0-NEXT:    addi a1, sp, 1645; SPILL-O0-NEXT:    vl1r.v v10, (a1) # vscale x 8-byte Folded Reload46; SPILL-O0-NEXT:    csrr a1, vlenb47; SPILL-O0-NEXT:    add a1, sp, a148; SPILL-O0-NEXT:    addi a1, a1, 1649; SPILL-O0-NEXT:    vl1r.v v9, (a1) # vscale x 8-byte Folded Reload50; SPILL-O0-NEXT:    # kill: def $x11 killed $x1051; SPILL-O0-NEXT:    lw a0, 8(sp) # 4-byte Folded Reload52; SPILL-O0-NEXT:    # implicit-def: $v853; SPILL-O0-NEXT:    vsetvli zero, a0, e64, m1, tu, ma54; SPILL-O0-NEXT:    vfadd.vv v8, v9, v1055; SPILL-O0-NEXT:    csrr a0, vlenb56; SPILL-O0-NEXT:    slli a0, a0, 157; SPILL-O0-NEXT:    add sp, sp, a058; SPILL-O0-NEXT:    .cfi_def_cfa sp, 3259; SPILL-O0-NEXT:    lw ra, 28(sp) # 4-byte Folded Reload60; SPILL-O0-NEXT:    .cfi_restore ra61; SPILL-O0-NEXT:    addi sp, sp, 3262; SPILL-O0-NEXT:    .cfi_def_cfa_offset 063; SPILL-O0-NEXT:    ret64;65; SPILL-O2-LABEL: foo:66; SPILL-O2:       # %bb.0:67; SPILL-O2-NEXT:    addi sp, sp, -3268; SPILL-O2-NEXT:    .cfi_def_cfa_offset 3269; SPILL-O2-NEXT:    sw ra, 28(sp) # 4-byte Folded Spill70; SPILL-O2-NEXT:    sw s0, 24(sp) # 4-byte Folded Spill71; SPILL-O2-NEXT:    .cfi_offset ra, -472; SPILL-O2-NEXT:    .cfi_offset s0, -873; SPILL-O2-NEXT:    csrr a1, vlenb74; SPILL-O2-NEXT:    slli a1, a1, 175; SPILL-O2-NEXT:    sub sp, sp, a176; SPILL-O2-NEXT:    .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x20, 0x22, 0x11, 0x02, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 32 + 2 * vlenb77; SPILL-O2-NEXT:    mv s0, a078; SPILL-O2-NEXT:    addi a1, sp, 1679; SPILL-O2-NEXT:    vs1r.v v8, (a1) # vscale x 8-byte Folded Spill80; SPILL-O2-NEXT:    vsetvli zero, a0, e64, m1, ta, ma81; SPILL-O2-NEXT:    vfadd.vv v9, v8, v982; SPILL-O2-NEXT:    csrr a0, vlenb83; SPILL-O2-NEXT:    add a0, sp, a084; SPILL-O2-NEXT:    addi a0, a0, 1685; SPILL-O2-NEXT:    vs1r.v v9, (a0) # vscale x 8-byte Folded Spill86; SPILL-O2-NEXT:    lui a0, %hi(.L.str)87; SPILL-O2-NEXT:    addi a0, a0, %lo(.L.str)88; SPILL-O2-NEXT:    call puts89; SPILL-O2-NEXT:    csrr a0, vlenb90; SPILL-O2-NEXT:    add a0, sp, a091; SPILL-O2-NEXT:    addi a0, a0, 1692; SPILL-O2-NEXT:    vl1r.v v8, (a0) # vscale x 8-byte Folded Reload93; SPILL-O2-NEXT:    addi a0, sp, 1694; SPILL-O2-NEXT:    vl1r.v v9, (a0) # vscale x 8-byte Folded Reload95; SPILL-O2-NEXT:    vsetvli zero, s0, e64, m1, ta, ma96; SPILL-O2-NEXT:    vfadd.vv v8, v9, v897; SPILL-O2-NEXT:    csrr a0, vlenb98; SPILL-O2-NEXT:    slli a0, a0, 199; SPILL-O2-NEXT:    add sp, sp, a0100; SPILL-O2-NEXT:    .cfi_def_cfa sp, 32101; SPILL-O2-NEXT:    lw ra, 28(sp) # 4-byte Folded Reload102; SPILL-O2-NEXT:    lw s0, 24(sp) # 4-byte Folded Reload103; SPILL-O2-NEXT:    .cfi_restore ra104; SPILL-O2-NEXT:    .cfi_restore s0105; SPILL-O2-NEXT:    addi sp, sp, 32106; SPILL-O2-NEXT:    .cfi_def_cfa_offset 0107; SPILL-O2-NEXT:    ret108;109; SPILL-O2-ZCMP-LABEL: foo:110; SPILL-O2-ZCMP:       # %bb.0:111; SPILL-O2-ZCMP-NEXT:    cm.push {ra, s0}, -32112; SPILL-O2-ZCMP-NEXT:    .cfi_def_cfa_offset 32113; SPILL-O2-ZCMP-NEXT:    .cfi_offset ra, -8114; SPILL-O2-ZCMP-NEXT:    .cfi_offset s0, -4115; SPILL-O2-ZCMP-NEXT:    csrr a1, vlenb116; SPILL-O2-ZCMP-NEXT:    slli a1, a1, 1117; SPILL-O2-ZCMP-NEXT:    sub sp, sp, a1118; SPILL-O2-ZCMP-NEXT:    .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x20, 0x22, 0x11, 0x02, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 32 + 2 * vlenb119; SPILL-O2-ZCMP-NEXT:    mv s0, a0120; SPILL-O2-ZCMP-NEXT:    addi a1, sp, 16121; SPILL-O2-ZCMP-NEXT:    vs1r.v v8, (a1) # vscale x 8-byte Folded Spill122; SPILL-O2-ZCMP-NEXT:    vsetvli zero, a0, e64, m1, ta, ma123; SPILL-O2-ZCMP-NEXT:    vfadd.vv v9, v8, v9124; SPILL-O2-ZCMP-NEXT:    csrr a0, vlenb125; SPILL-O2-ZCMP-NEXT:    add a0, a0, sp126; SPILL-O2-ZCMP-NEXT:    addi a0, a0, 16127; SPILL-O2-ZCMP-NEXT:    vs1r.v v9, (a0) # vscale x 8-byte Folded Spill128; SPILL-O2-ZCMP-NEXT:    lui a0, %hi(.L.str)129; SPILL-O2-ZCMP-NEXT:    addi a0, a0, %lo(.L.str)130; SPILL-O2-ZCMP-NEXT:    call puts131; SPILL-O2-ZCMP-NEXT:    csrr a0, vlenb132; SPILL-O2-ZCMP-NEXT:    add a0, a0, sp133; SPILL-O2-ZCMP-NEXT:    addi a0, a0, 16134; SPILL-O2-ZCMP-NEXT:    vl1r.v v8, (a0) # vscale x 8-byte Folded Reload135; SPILL-O2-ZCMP-NEXT:    addi a0, sp, 16136; SPILL-O2-ZCMP-NEXT:    vl1r.v v9, (a0) # vscale x 8-byte Folded Reload137; SPILL-O2-ZCMP-NEXT:    vsetvli zero, s0, e64, m1, ta, ma138; SPILL-O2-ZCMP-NEXT:    vfadd.vv v8, v9, v8139; SPILL-O2-ZCMP-NEXT:    csrr a0, vlenb140; SPILL-O2-ZCMP-NEXT:    slli a0, a0, 1141; SPILL-O2-ZCMP-NEXT:    add sp, sp, a0142; SPILL-O2-ZCMP-NEXT:    .cfi_def_cfa sp, 32143; SPILL-O2-ZCMP-NEXT:    cm.popret {ra, s0}, 32144;145; SPILL-O0-VSETVLI-LABEL: foo:146; SPILL-O0-VSETVLI:       # %bb.0:147; SPILL-O0-VSETVLI-NEXT:    addi sp, sp, -32148; SPILL-O0-VSETVLI-NEXT:    .cfi_def_cfa_offset 32149; SPILL-O0-VSETVLI-NEXT:    sw ra, 28(sp) # 4-byte Folded Spill150; SPILL-O0-VSETVLI-NEXT:    .cfi_offset ra, -4151; SPILL-O0-VSETVLI-NEXT:    vsetvli a1, zero, e8, m2, ta, ma152; SPILL-O0-VSETVLI-NEXT:    sub sp, sp, a1153; SPILL-O0-VSETVLI-NEXT:    .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x20, 0x22, 0x11, 0x02, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 32 + 2 * vlenb154; SPILL-O0-VSETVLI-NEXT:    sw a0, 8(sp) # 4-byte Folded Spill155; SPILL-O0-VSETVLI-NEXT:    vsetivli zero, 1, e8, m1, ta, ma156; SPILL-O0-VSETVLI-NEXT:    vmv1r.v v10, v9157; SPILL-O0-VSETVLI-NEXT:    vmv1r.v v9, v8158; SPILL-O0-VSETVLI-NEXT:    csrr a1, vlenb159; SPILL-O0-VSETVLI-NEXT:    add a1, sp, a1160; SPILL-O0-VSETVLI-NEXT:    addi a1, a1, 16161; SPILL-O0-VSETVLI-NEXT:    vs1r.v v9, (a1) # vscale x 8-byte Folded Spill162; SPILL-O0-VSETVLI-NEXT:    # implicit-def: $v8163; SPILL-O0-VSETVLI-NEXT:    vsetvli zero, a0, e64, m1, tu, ma164; SPILL-O0-VSETVLI-NEXT:    vfadd.vv v8, v9, v10165; SPILL-O0-VSETVLI-NEXT:    addi a0, sp, 16166; SPILL-O0-VSETVLI-NEXT:    vs1r.v v8, (a0) # vscale x 8-byte Folded Spill167; SPILL-O0-VSETVLI-NEXT:    lui a0, %hi(.L.str)168; SPILL-O0-VSETVLI-NEXT:    addi a0, a0, %lo(.L.str)169; SPILL-O0-VSETVLI-NEXT:    call puts170; SPILL-O0-VSETVLI-NEXT:    addi a1, sp, 16171; SPILL-O0-VSETVLI-NEXT:    vl1r.v v10, (a1) # vscale x 8-byte Folded Reload172; SPILL-O0-VSETVLI-NEXT:    csrr a1, vlenb173; SPILL-O0-VSETVLI-NEXT:    add a1, sp, a1174; SPILL-O0-VSETVLI-NEXT:    addi a1, a1, 16175; SPILL-O0-VSETVLI-NEXT:    vl1r.v v9, (a1) # vscale x 8-byte Folded Reload176; SPILL-O0-VSETVLI-NEXT:    # kill: def $x11 killed $x10177; SPILL-O0-VSETVLI-NEXT:    lw a0, 8(sp) # 4-byte Folded Reload178; SPILL-O0-VSETVLI-NEXT:    # implicit-def: $v8179; SPILL-O0-VSETVLI-NEXT:    vsetvli zero, a0, e64, m1, tu, ma180; SPILL-O0-VSETVLI-NEXT:    vfadd.vv v8, v9, v10181; SPILL-O0-VSETVLI-NEXT:    vsetvli a0, zero, e8, m2, ta, ma182; SPILL-O0-VSETVLI-NEXT:    add sp, sp, a0183; SPILL-O0-VSETVLI-NEXT:    .cfi_def_cfa sp, 32184; SPILL-O0-VSETVLI-NEXT:    lw ra, 28(sp) # 4-byte Folded Reload185; SPILL-O0-VSETVLI-NEXT:    .cfi_restore ra186; SPILL-O0-VSETVLI-NEXT:    addi sp, sp, 32187; SPILL-O0-VSETVLI-NEXT:    .cfi_def_cfa_offset 0188; SPILL-O0-VSETVLI-NEXT:    ret189;190; SPILL-O2-VSETVLI-LABEL: foo:191; SPILL-O2-VSETVLI:       # %bb.0:192; SPILL-O2-VSETVLI-NEXT:    addi sp, sp, -32193; SPILL-O2-VSETVLI-NEXT:    .cfi_def_cfa_offset 32194; SPILL-O2-VSETVLI-NEXT:    sw ra, 28(sp) # 4-byte Folded Spill195; SPILL-O2-VSETVLI-NEXT:    sw s0, 24(sp) # 4-byte Folded Spill196; SPILL-O2-VSETVLI-NEXT:    .cfi_offset ra, -4197; SPILL-O2-VSETVLI-NEXT:    .cfi_offset s0, -8198; SPILL-O2-VSETVLI-NEXT:    vsetvli a1, zero, e8, m2, ta, ma199; SPILL-O2-VSETVLI-NEXT:    sub sp, sp, a1200; SPILL-O2-VSETVLI-NEXT:    .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x20, 0x22, 0x11, 0x02, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 32 + 2 * vlenb201; SPILL-O2-VSETVLI-NEXT:    mv s0, a0202; SPILL-O2-VSETVLI-NEXT:    addi a1, sp, 16203; SPILL-O2-VSETVLI-NEXT:    vs1r.v v8, (a1) # vscale x 8-byte Folded Spill204; SPILL-O2-VSETVLI-NEXT:    vsetvli zero, a0, e64, m1, ta, ma205; SPILL-O2-VSETVLI-NEXT:    vfadd.vv v9, v8, v9206; SPILL-O2-VSETVLI-NEXT:    csrr a0, vlenb207; SPILL-O2-VSETVLI-NEXT:    add a0, sp, a0208; SPILL-O2-VSETVLI-NEXT:    addi a0, a0, 16209; SPILL-O2-VSETVLI-NEXT:    vs1r.v v9, (a0) # vscale x 8-byte Folded Spill210; SPILL-O2-VSETVLI-NEXT:    lui a0, %hi(.L.str)211; SPILL-O2-VSETVLI-NEXT:    addi a0, a0, %lo(.L.str)212; SPILL-O2-VSETVLI-NEXT:    call puts213; SPILL-O2-VSETVLI-NEXT:    csrr a0, vlenb214; SPILL-O2-VSETVLI-NEXT:    add a0, sp, a0215; SPILL-O2-VSETVLI-NEXT:    addi a0, a0, 16216; SPILL-O2-VSETVLI-NEXT:    vl1r.v v8, (a0) # vscale x 8-byte Folded Reload217; SPILL-O2-VSETVLI-NEXT:    addi a0, sp, 16218; SPILL-O2-VSETVLI-NEXT:    vl1r.v v9, (a0) # vscale x 8-byte Folded Reload219; SPILL-O2-VSETVLI-NEXT:    vsetvli zero, s0, e64, m1, ta, ma220; SPILL-O2-VSETVLI-NEXT:    vfadd.vv v8, v9, v8221; SPILL-O2-VSETVLI-NEXT:    vsetvli a0, zero, e8, m2, ta, ma222; SPILL-O2-VSETVLI-NEXT:    add sp, sp, a0223; SPILL-O2-VSETVLI-NEXT:    .cfi_def_cfa sp, 32224; SPILL-O2-VSETVLI-NEXT:    lw ra, 28(sp) # 4-byte Folded Reload225; SPILL-O2-VSETVLI-NEXT:    lw s0, 24(sp) # 4-byte Folded Reload226; SPILL-O2-VSETVLI-NEXT:    .cfi_restore ra227; SPILL-O2-VSETVLI-NEXT:    .cfi_restore s0228; SPILL-O2-VSETVLI-NEXT:    addi sp, sp, 32229; SPILL-O2-VSETVLI-NEXT:    .cfi_def_cfa_offset 0230; SPILL-O2-VSETVLI-NEXT:    ret231;232; SPILL-O2-ZCMP-VSETVLI-LABEL: foo:233; SPILL-O2-ZCMP-VSETVLI:       # %bb.0:234; SPILL-O2-ZCMP-VSETVLI-NEXT:    cm.push {ra, s0}, -32235; SPILL-O2-ZCMP-VSETVLI-NEXT:    .cfi_def_cfa_offset 32236; SPILL-O2-ZCMP-VSETVLI-NEXT:    .cfi_offset ra, -8237; SPILL-O2-ZCMP-VSETVLI-NEXT:    .cfi_offset s0, -4238; SPILL-O2-ZCMP-VSETVLI-NEXT:    vsetvli a1, zero, e8, m2, ta, ma239; SPILL-O2-ZCMP-VSETVLI-NEXT:    sub sp, sp, a1240; SPILL-O2-ZCMP-VSETVLI-NEXT:    .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x20, 0x22, 0x11, 0x02, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 32 + 2 * vlenb241; SPILL-O2-ZCMP-VSETVLI-NEXT:    mv s0, a0242; SPILL-O2-ZCMP-VSETVLI-NEXT:    addi a1, sp, 16243; SPILL-O2-ZCMP-VSETVLI-NEXT:    vs1r.v v8, (a1) # vscale x 8-byte Folded Spill244; SPILL-O2-ZCMP-VSETVLI-NEXT:    vsetvli zero, a0, e64, m1, ta, ma245; SPILL-O2-ZCMP-VSETVLI-NEXT:    vfadd.vv v9, v8, v9246; SPILL-O2-ZCMP-VSETVLI-NEXT:    csrr a0, vlenb247; SPILL-O2-ZCMP-VSETVLI-NEXT:    add a0, a0, sp248; SPILL-O2-ZCMP-VSETVLI-NEXT:    addi a0, a0, 16249; SPILL-O2-ZCMP-VSETVLI-NEXT:    vs1r.v v9, (a0) # vscale x 8-byte Folded Spill250; SPILL-O2-ZCMP-VSETVLI-NEXT:    lui a0, %hi(.L.str)251; SPILL-O2-ZCMP-VSETVLI-NEXT:    addi a0, a0, %lo(.L.str)252; SPILL-O2-ZCMP-VSETVLI-NEXT:    call puts253; SPILL-O2-ZCMP-VSETVLI-NEXT:    csrr a0, vlenb254; SPILL-O2-ZCMP-VSETVLI-NEXT:    add a0, a0, sp255; SPILL-O2-ZCMP-VSETVLI-NEXT:    addi a0, a0, 16256; SPILL-O2-ZCMP-VSETVLI-NEXT:    vl1r.v v8, (a0) # vscale x 8-byte Folded Reload257; SPILL-O2-ZCMP-VSETVLI-NEXT:    addi a0, sp, 16258; SPILL-O2-ZCMP-VSETVLI-NEXT:    vl1r.v v9, (a0) # vscale x 8-byte Folded Reload259; SPILL-O2-ZCMP-VSETVLI-NEXT:    vsetvli zero, s0, e64, m1, ta, ma260; SPILL-O2-ZCMP-VSETVLI-NEXT:    vfadd.vv v8, v9, v8261; SPILL-O2-ZCMP-VSETVLI-NEXT:    vsetvli a0, zero, e8, m2, ta, ma262; SPILL-O2-ZCMP-VSETVLI-NEXT:    add sp, sp, a0263; SPILL-O2-ZCMP-VSETVLI-NEXT:    .cfi_def_cfa sp, 32264; SPILL-O2-ZCMP-VSETVLI-NEXT:    cm.popret {ra, s0}, 32265{266   %x = call <vscale x 1 x double> @llvm.riscv.vfadd.nxv1f64.nxv1f64(<vscale x 1 x double> poison, <vscale x 1 x double> %a, <vscale x 1 x double> %b, i32 7, i32 %gvl)267   %call = call signext i32 @puts(ptr @.str)268   %z = call <vscale x 1 x double> @llvm.riscv.vfadd.nxv1f64.nxv1f64(<vscale x 1 x double> poison, <vscale x 1 x double> %a, <vscale x 1 x double> %x, i32 7, i32 %gvl)269   ret <vscale x 1 x double> %z270}271 272declare i32 @puts(ptr);273