brintos

brintos / llvm-project-archived public Read only

0
0
Text · 22.7 KiB · 077a3aa Raw
722 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -mattr=+sme -S -passes=inline | FileCheck %s3 4declare i32 @llvm.vscale.i32()5 6; Define some functions that merely call llvm.vscale.i32(), which will be called7; by the other functions below. If we see the call to one of these functions8; being replaced by 'llvm.vscale()', then we know it has been inlined.9 10define i32 @normal_callee() #0 {11; CHECK-LABEL: define i32 @normal_callee12; CHECK-SAME: () #[[ATTR1:[0-9]+]] {13; CHECK-NEXT:  entry:14; CHECK-NEXT:    [[RES:%.*]] = call i32 @llvm.vscale.i32()15; CHECK-NEXT:    ret i32 [[RES]]16;17entry:18  %res = call i32 @llvm.vscale.i32()19  ret i32 %res20}21 22define i32 @streaming_callee() #0 "aarch64_pstate_sm_enabled" {23; CHECK-LABEL: define i32 @streaming_callee24; CHECK-SAME: () #[[ATTR2:[0-9]+]] {25; CHECK-NEXT:  entry:26; CHECK-NEXT:    [[RES:%.*]] = call i32 @llvm.vscale.i32()27; CHECK-NEXT:    ret i32 [[RES]]28;29entry:30  %res = call i32 @llvm.vscale.i32()31  ret i32 %res32}33 34define i32 @locally_streaming_callee() #0 "aarch64_pstate_sm_body" {35; CHECK-LABEL: define i32 @locally_streaming_callee36; CHECK-SAME: () #[[ATTR3:[0-9]+]] {37; CHECK-NEXT:  entry:38; CHECK-NEXT:    [[RES:%.*]] = call i32 @llvm.vscale.i32()39; CHECK-NEXT:    ret i32 [[RES]]40;41entry:42  %res = call i32 @llvm.vscale.i32()43  ret i32 %res44}45 46define i32 @streaming_compatible_callee() #0 "aarch64_pstate_sm_compatible" {47; CHECK-LABEL: define i32 @streaming_compatible_callee48; CHECK-SAME: () #[[ATTR4:[0-9]+]] {49; CHECK-NEXT:  entry:50; CHECK-NEXT:    [[RES:%.*]] = call i32 @llvm.vscale.i32()51; CHECK-NEXT:    ret i32 [[RES]]52;53entry:54  %res = call i32 @llvm.vscale.i32()55  ret i32 %res56}57 58define i32 @streaming_compatible_locally_streaming_callee() #0 "aarch64_pstate_sm_compatible" "aarch64_pstate_sm_body" {59; CHECK-LABEL: define i32 @streaming_compatible_locally_streaming_callee60; CHECK-SAME: () #[[ATTR5:[0-9]+]] {61; CHECK-NEXT:  entry:62; CHECK-NEXT:    [[RES:%.*]] = call i32 @llvm.vscale.i32()63; CHECK-NEXT:    ret i32 [[RES]]64;65entry:66  %res = call i32 @llvm.vscale()67  ret i32 %res68}69 70; Now test that inlining only happens when their streaming modes match.71; Test for a number of combinations, where:72; N       Normal-interface (PSTATE.SM=0 on entry/exit)73; S       Streaming-interface (PSTATE.SM=1 on entry/exit)74; SC      Streaming-compatible interface75;         (PSTATE.SM=0 or 1, unchanged on exit)76; N + B   Normal-interface, streaming body77;         (PSTATE.SM=0 on entry/exit, but 1 within the body of the function)78; SC + B  Streaming-compatible-interface, streaming body79;         (PSTATE.SM=0 or 1 on entry, unchanged on exit,80;          but guaranteed to be 1 within the body of the function)81 82; [x] N  -> N83; [ ] N  -> S84; [ ] N  -> SC85; [ ] N  -> N + B86; [ ] N  -> SC + B87define i32 @normal_caller_normal_callee_inline() #0 {88; CHECK-LABEL: define i32 @normal_caller_normal_callee_inline89; CHECK-SAME: () #[[ATTR1]] {90; CHECK-NEXT:  entry:91; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()92; CHECK-NEXT:    ret i32 [[RES_I]]93;94entry:95  %res = call i32 @normal_callee()96  ret i32 %res97}98 99; [ ] N  -> N100; [x] N  -> S101; [ ] N  -> SC102; [ ] N  -> N + B103; [ ] N  -> SC + B104define i32 @normal_caller_streaming_callee_dont_inline() #0 {105; CHECK-LABEL: define i32 @normal_caller_streaming_callee_dont_inline106; CHECK-SAME: () #[[ATTR1]] {107; CHECK-NEXT:  entry:108; CHECK-NEXT:    [[RES:%.*]] = call i32 @streaming_callee()109; CHECK-NEXT:    ret i32 [[RES]]110;111entry:112  %res = call i32 @streaming_callee()113  ret i32 %res114}115 116; [ ] N  -> N117; [ ] N  -> S118; [x] N  -> SC119; [ ] N  -> N + B120; [ ] N  -> SC + B121define i32 @normal_caller_streaming_compatible_callee_inline() #0  {122; CHECK-LABEL: define i32 @normal_caller_streaming_compatible_callee_inline123; CHECK-SAME: () #[[ATTR1]] {124; CHECK-NEXT:  entry:125; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()126; CHECK-NEXT:    ret i32 [[RES_I]]127;128entry:129  %res = call i32 @streaming_compatible_callee()130  ret i32 %res131}132 133; [ ] N  -> N134; [ ] N  -> S135; [ ] N  -> SC136; [x] N  -> N + B137; [ ] N  -> SC + B138define i32 @normal_caller_locally_streaming_callee_dont_inline() #0  {139; CHECK-LABEL: define i32 @normal_caller_locally_streaming_callee_dont_inline140; CHECK-SAME: () #[[ATTR1]] {141; CHECK-NEXT:  entry:142; CHECK-NEXT:    [[RES:%.*]] = call i32 @locally_streaming_callee()143; CHECK-NEXT:    ret i32 [[RES]]144;145entry:146  %res = call i32 @locally_streaming_callee()147  ret i32 %res148}149 150; [ ] N  -> N151; [ ] N  -> S152; [ ] N  -> SC153; [ ] N  -> N + B154; [x] N  -> SC + B155define i32 @normal_caller_streaming_compatible_locally_streaming_callee_dont_inline() #0  {156; CHECK-LABEL: define i32 @normal_caller_streaming_compatible_locally_streaming_callee_dont_inline157; CHECK-SAME: () #[[ATTR1]] {158; CHECK-NEXT:  entry:159; CHECK-NEXT:    [[RES:%.*]] = call i32 @streaming_compatible_locally_streaming_callee()160; CHECK-NEXT:    ret i32 [[RES]]161;162entry:163  %res = call i32 @streaming_compatible_locally_streaming_callee()164  ret i32 %res165}166 167; [x] S  -> N168; [ ] S  -> S169; [ ] S  -> SC170; [ ] S  -> N + B171; [ ] S  -> SC + B172define i32 @streaming_caller_normal_callee_dont_inline() #0  "aarch64_pstate_sm_enabled" {173; CHECK-LABEL: define i32 @streaming_caller_normal_callee_dont_inline174; CHECK-SAME: () #[[ATTR2]] {175; CHECK-NEXT:  entry:176; CHECK-NEXT:    [[RES:%.*]] = call i32 @normal_callee()177; CHECK-NEXT:    ret i32 [[RES]]178;179entry:180  %res = call i32 @normal_callee()181  ret i32 %res182}183 184; [ ] S  -> N185; [x] S  -> S186; [ ] S  -> SC187; [ ] S  -> N + B188; [ ] S  -> SC + B189define i32 @streaming_caller_streaming_callee_inline() #0  "aarch64_pstate_sm_enabled" {190; CHECK-LABEL: define i32 @streaming_caller_streaming_callee_inline191; CHECK-SAME: () #[[ATTR2]] {192; CHECK-NEXT:  entry:193; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()194; CHECK-NEXT:    ret i32 [[RES_I]]195;196entry:197  %res = call i32 @streaming_callee()198  ret i32 %res199}200 201; [ ] S  -> N202; [ ] S  -> S203; [x] S  -> SC204; [ ] S  -> N + B205; [ ] S  -> SC + B206define i32 @streaming_caller_streaming_compatible_callee_inline() #0  "aarch64_pstate_sm_enabled" {207; CHECK-LABEL: define i32 @streaming_caller_streaming_compatible_callee_inline208; CHECK-SAME: () #[[ATTR2]] {209; CHECK-NEXT:  entry:210; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()211; CHECK-NEXT:    ret i32 [[RES_I]]212;213entry:214  %res = call i32 @streaming_compatible_callee()215  ret i32 %res216}217 218; [ ] S  -> N219; [ ] S  -> S220; [ ] S  -> SC221; [x] S  -> N + B222; [ ] S  -> SC + B223define i32 @streaming_caller_locally_streaming_callee_inline() #0  "aarch64_pstate_sm_enabled" {224; CHECK-LABEL: define i32 @streaming_caller_locally_streaming_callee_inline225; CHECK-SAME: () #[[ATTR2]] {226; CHECK-NEXT:  entry:227; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()228; CHECK-NEXT:    ret i32 [[RES_I]]229;230entry:231  %res = call i32 @locally_streaming_callee()232  ret i32 %res233}234 235; [ ] S  -> N236; [ ] S  -> S237; [ ] S  -> SC238; [ ] S  -> N + B239; [x] S  -> SC + B240define i32 @streaming_caller_streaming_compatible_locally_streaming_callee_inline() #0  "aarch64_pstate_sm_enabled" {241; CHECK-LABEL: define i32 @streaming_caller_streaming_compatible_locally_streaming_callee_inline242; CHECK-SAME: () #[[ATTR2]] {243; CHECK-NEXT:  entry:244; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()245; CHECK-NEXT:    ret i32 [[RES_I]]246;247entry:248  %res = call i32 @streaming_compatible_locally_streaming_callee()249  ret i32 %res250}251 252; [x] N + B -> N253; [ ] N + B -> S254; [ ] N + B -> SC255; [ ] N + B -> N + B256; [ ] N + B -> SC + B257define i32 @locally_streaming_caller_normal_callee_dont_inline() #0  "aarch64_pstate_sm_body" {258; CHECK-LABEL: define i32 @locally_streaming_caller_normal_callee_dont_inline259; CHECK-SAME: () #[[ATTR3]] {260; CHECK-NEXT:  entry:261; CHECK-NEXT:    [[RES:%.*]] = call i32 @normal_callee()262; CHECK-NEXT:    ret i32 [[RES]]263;264entry:265  %res = call i32 @normal_callee()266  ret i32 %res267}268 269; [ ] N + B -> N270; [x] N + B -> S271; [ ] N + B -> SC272; [ ] N + B -> N + B273; [ ] N + B -> SC + B274define i32 @locally_streaming_caller_streaming_callee_inline() #0  "aarch64_pstate_sm_body" {275; CHECK-LABEL: define i32 @locally_streaming_caller_streaming_callee_inline276; CHECK-SAME: () #[[ATTR3]] {277; CHECK-NEXT:  entry:278; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()279; CHECK-NEXT:    ret i32 [[RES_I]]280;281entry:282  %res = call i32 @streaming_callee()283  ret i32 %res284}285 286; [ ] N + B -> N287; [ ] N + B -> S288; [x] N + B -> SC289; [ ] N + B -> N + B290; [ ] N + B -> SC + B291define i32 @locally_streaming_caller_streaming_compatible_callee_inline() #0  "aarch64_pstate_sm_body" {292; CHECK-LABEL: define i32 @locally_streaming_caller_streaming_compatible_callee_inline293; CHECK-SAME: () #[[ATTR3]] {294; CHECK-NEXT:  entry:295; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()296; CHECK-NEXT:    ret i32 [[RES_I]]297;298entry:299  %res = call i32 @streaming_compatible_callee()300  ret i32 %res301}302 303; [ ] N + B -> N304; [ ] N + B -> S305; [ ] N + B -> SC306; [x] N + B -> N + B307; [ ] N + B -> SC + B308define i32 @locally_streaming_caller_locally_streaming_callee_inline() #0  "aarch64_pstate_sm_body" {309; CHECK-LABEL: define i32 @locally_streaming_caller_locally_streaming_callee_inline310; CHECK-SAME: () #[[ATTR3]] {311; CHECK-NEXT:  entry:312; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()313; CHECK-NEXT:    ret i32 [[RES_I]]314;315entry:316  %res = call i32 @locally_streaming_callee()317  ret i32 %res318}319 320; [ ] N + B -> N321; [ ] N + B -> S322; [ ] N + B -> SC323; [ ] N + B -> N + B324; [x] N + B -> SC + B325define i32 @locally_streaming_caller_streaming_compatible_locally_streaming_callee_inline() #0  "aarch64_pstate_sm_body" {326; CHECK-LABEL: define i32 @locally_streaming_caller_streaming_compatible_locally_streaming_callee_inline327; CHECK-SAME: () #[[ATTR3]] {328; CHECK-NEXT:  entry:329; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()330; CHECK-NEXT:    ret i32 [[RES_I]]331;332entry:333  %res = call i32 @streaming_compatible_locally_streaming_callee()334  ret i32 %res335}336 337; [x] SC -> N338; [ ] SC -> S339; [ ] SC -> SC340; [ ] SC -> N + B341; [ ] SC -> SC + B342define i32 @streaming_compatible_caller_normal_callee_dont_inline() #0  "aarch64_pstate_sm_compatible" {343; CHECK-LABEL: define i32 @streaming_compatible_caller_normal_callee_dont_inline344; CHECK-SAME: () #[[ATTR4]] {345; CHECK-NEXT:  entry:346; CHECK-NEXT:    [[RES:%.*]] = call i32 @normal_callee()347; CHECK-NEXT:    ret i32 [[RES]]348;349entry:350  %res = call i32 @normal_callee()351  ret i32 %res352}353 354; [ ] SC -> N355; [x] SC -> S356; [ ] SC -> SC357; [ ] SC -> N + B358; [ ] SC -> SC + B359define i32 @streaming_compatible_caller_streaming_callee_dont_inline() #0  "aarch64_pstate_sm_compatible" {360; CHECK-LABEL: define i32 @streaming_compatible_caller_streaming_callee_dont_inline361; CHECK-SAME: () #[[ATTR4]] {362; CHECK-NEXT:  entry:363; CHECK-NEXT:    [[RES:%.*]] = call i32 @streaming_callee()364; CHECK-NEXT:    ret i32 [[RES]]365;366entry:367  %res = call i32 @streaming_callee()368  ret i32 %res369}370 371; [ ] SC -> N372; [ ] SC -> S373; [x] SC -> SC374; [ ] SC -> N + B375; [ ] SC -> SC + B376define i32 @streaming_compatible_caller_streaming_compatible_callee_inline() #0  "aarch64_pstate_sm_compatible" {377; CHECK-LABEL: define i32 @streaming_compatible_caller_streaming_compatible_callee_inline378; CHECK-SAME: () #[[ATTR4]] {379; CHECK-NEXT:  entry:380; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()381; CHECK-NEXT:    ret i32 [[RES_I]]382;383entry:384  %res = call i32 @streaming_compatible_callee()385  ret i32 %res386}387 388; [ ] SC -> N389; [ ] SC -> S390; [ ] SC -> SC391; [x] SC -> N + B392; [ ] SC -> SC + B393define i32 @streaming_compatible_caller_locally_streaming_callee_dont_inline() #0  "aarch64_pstate_sm_compatible" {394; CHECK-LABEL: define i32 @streaming_compatible_caller_locally_streaming_callee_dont_inline395; CHECK-SAME: () #[[ATTR4]] {396; CHECK-NEXT:  entry:397; CHECK-NEXT:    [[RES:%.*]] = call i32 @locally_streaming_callee()398; CHECK-NEXT:    ret i32 [[RES]]399;400entry:401  %res = call i32 @locally_streaming_callee()402  ret i32 %res403}404 405; [ ] SC -> N406; [ ] SC -> S407; [ ] SC -> SC408; [ ] SC -> N + B409; [x] SC -> SC + B410define i32 @streaming_compatible_caller_streaming_compatible_locally_streaming_callee_dont_inline() #0  "aarch64_pstate_sm_compatible" {411; CHECK-LABEL: define i32 @streaming_compatible_caller_streaming_compatible_locally_streaming_callee_dont_inline412; CHECK-SAME: () #[[ATTR4]] {413; CHECK-NEXT:  entry:414; CHECK-NEXT:    [[RES:%.*]] = call i32 @streaming_compatible_locally_streaming_callee()415; CHECK-NEXT:    ret i32 [[RES]]416;417entry:418  %res = call i32 @streaming_compatible_locally_streaming_callee()419  ret i32 %res420}421; [x] SC + B -> N422; [ ] SC + B -> S423; [ ] SC + B -> SC424; [ ] SC + B -> N + B425; [ ] SC + B -> SC + B426define i32 @streaming_compatible_locally_streaming_caller_normal_callee_dont_inline() #0  "aarch64_pstate_sm_compatible" "aarch64_pstate_sm_body" {427; CHECK-LABEL: define i32 @streaming_compatible_locally_streaming_caller_normal_callee_dont_inline428; CHECK-SAME: () #[[ATTR5]] {429; CHECK-NEXT:  entry:430; CHECK-NEXT:    [[RES:%.*]] = call i32 @normal_callee()431; CHECK-NEXT:    ret i32 [[RES]]432;433entry:434  %res = call i32 @normal_callee()435  ret i32 %res436}437 438; [ ] SC + B -> N439; [x] SC + B -> S440; [ ] SC + B -> SC441; [ ] SC + B -> N + B442; [ ] SC + B -> SC + B443define i32 @streaming_compatible_locally_streaming_caller_streaming_callee_inline() #0  "aarch64_pstate_sm_compatible" "aarch64_pstate_sm_body" {444; CHECK-LABEL: define i32 @streaming_compatible_locally_streaming_caller_streaming_callee_inline445; CHECK-SAME: () #[[ATTR5]] {446; CHECK-NEXT:  entry:447; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()448; CHECK-NEXT:    ret i32 [[RES_I]]449;450entry:451  %res = call i32 @streaming_callee()452  ret i32 %res453}454 455; [ ] SC + B -> N456; [ ] SC + B -> S457; [x] SC + B -> SC458; [ ] SC + B -> N + B459; [ ] SC + B -> SC + B460define i32 @streaming_compatible_locally_streaming_caller_streaming_compatible_callee_inline() #0  "aarch64_pstate_sm_compatible" "aarch64_pstate_sm_body" {461; CHECK-LABEL: define i32 @streaming_compatible_locally_streaming_caller_streaming_compatible_callee_inline462; CHECK-SAME: () #[[ATTR5]] {463; CHECK-NEXT:  entry:464; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()465; CHECK-NEXT:    ret i32 [[RES_I]]466;467entry:468  %res = call i32 @streaming_compatible_callee()469  ret i32 %res470}471 472; [ ] SC + B -> N473; [ ] SC + B -> S474; [ ] SC + B -> SC475; [x] SC + B -> N + B476; [ ] SC + B -> SC + B477define i32 @streaming_compatible_locally_streaming_caller_locally_streaming_callee_inline() #0  "aarch64_pstate_sm_compatible" "aarch64_pstate_sm_body" {478; CHECK-LABEL: define i32 @streaming_compatible_locally_streaming_caller_locally_streaming_callee_inline479; CHECK-SAME: () #[[ATTR5]] {480; CHECK-NEXT:  entry:481; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()482; CHECK-NEXT:    ret i32 [[RES_I]]483;484entry:485  %res = call i32 @locally_streaming_callee()486  ret i32 %res487}488 489; [ ] SC + B -> N490; [ ] SC + B -> S491; [ ] SC + B -> SC492; [ ] SC + B -> N + B493; [x] SC + B -> SC + B494define i32 @streaming_compatible_locally_streaming_caller_and_callee_inline() #0  "aarch64_pstate_sm_compatible" "aarch64_pstate_sm_body" {495; CHECK-LABEL: define i32 @streaming_compatible_locally_streaming_caller_and_callee_inline496; CHECK-SAME: () #[[ATTR5]] {497; CHECK-NEXT:  entry:498; CHECK-NEXT:    [[RES_I:%.*]] = call i32 @llvm.vscale.i32()499; CHECK-NEXT:    ret i32 [[RES_I]]500;501entry:502  %res = call i32 @streaming_compatible_locally_streaming_callee()503  ret i32 %res504}505 506define void @normal_callee_with_inlineasm() #0  {507; CHECK-LABEL: define void @normal_callee_with_inlineasm508; CHECK-SAME: () #[[ATTR1]] {509; CHECK-NEXT:  entry:510; CHECK-NEXT:    call void asm sideeffect "511; CHECK-NEXT:    ret void512;513entry:514  call void asm sideeffect "; inlineasm", ""()515  ret void516}517 518define void @streaming_caller_normal_callee_with_inlineasm_dont_inline() #0  "aarch64_pstate_sm_enabled" {519; CHECK-LABEL: define void @streaming_caller_normal_callee_with_inlineasm_dont_inline520; CHECK-SAME: () #[[ATTR2]] {521; CHECK-NEXT:  entry:522; CHECK-NEXT:    call void @normal_callee_with_inlineasm()523; CHECK-NEXT:    ret void524;525entry:526  call void @normal_callee_with_inlineasm()527  ret void528}529 530define i64 @normal_callee_with_intrinsic_call() #0  {531; CHECK-LABEL: define i64 @normal_callee_with_intrinsic_call532; CHECK-SAME: () #[[ATTR1]] {533; CHECK-NEXT:  entry:534; CHECK-NEXT:    [[RES:%.*]] = call i64 @llvm.aarch64.sve.cntb(i32 4)535; CHECK-NEXT:    ret i64 [[RES]]536;537entry:538  %res = call i64 @llvm.aarch64.sve.cntb(i32 4)539  ret i64 %res540}541 542define i64 @streaming_caller_normal_callee_with_intrinsic_call_dont_inline() #0  "aarch64_pstate_sm_enabled" {543; CHECK-LABEL: define i64 @streaming_caller_normal_callee_with_intrinsic_call_dont_inline544; CHECK-SAME: () #[[ATTR2]] {545; CHECK-NEXT:  entry:546; CHECK-NEXT:    [[RES:%.*]] = call i64 @normal_callee_with_intrinsic_call()547; CHECK-NEXT:    ret i64 [[RES]]548;549entry:550  %res = call i64 @normal_callee_with_intrinsic_call()551  ret i64 %res552}553 554declare i64 @llvm.aarch64.sve.cntb(i32)555 556define i64 @normal_callee_call_sme_state() #0  {557; CHECK-LABEL: define i64 @normal_callee_call_sme_state558; CHECK-SAME: () #[[ATTR1]] {559; CHECK-NEXT:  entry:560; CHECK-NEXT:    [[RES:%.*]] = call { i64, i64 } @__arm_sme_state()561; CHECK-NEXT:    [[RES_0:%.*]] = extractvalue { i64, i64 } [[RES]], 0562; CHECK-NEXT:    ret i64 [[RES_0]]563;564entry:565  %res = call {i64, i64} @__arm_sme_state()566  %res.0 = extractvalue {i64, i64} %res, 0567  ret i64 %res.0568}569 570declare {i64, i64} @__arm_sme_state()571 572define i64 @streaming_caller_normal_callee_call_sme_state_dont_inline() #0  "aarch64_pstate_sm_enabled" {573; CHECK-LABEL: define i64 @streaming_caller_normal_callee_call_sme_state_dont_inline574; CHECK-SAME: () #[[ATTR2]] {575; CHECK-NEXT:  entry:576; CHECK-NEXT:    [[RES:%.*]] = call i64 @normal_callee_call_sme_state()577; CHECK-NEXT:    ret i64 [[RES]]578;579entry:580  %res = call i64 @normal_callee_call_sme_state()581  ret i64 %res582}583 584 585 586declare void @nonstreaming_body()587 588define void @nonstreaming_caller_single_nonstreaming_callee() #0 {589; CHECK-LABEL: define void @nonstreaming_caller_single_nonstreaming_callee590; CHECK-SAME: () #[[ATTR1]] {591; CHECK-NEXT:    call void @nonstreaming_body()592; CHECK-NEXT:    ret void593;594  call void @nonstreaming_body()595  ret void596}597 598define void @nonstreaming_caller_multiple_nonstreaming_callees() #0 {599; CHECK-LABEL: define void @nonstreaming_caller_multiple_nonstreaming_callees600; CHECK-SAME: () #[[ATTR1]] {601; CHECK-NEXT:    call void @nonstreaming_body()602; CHECK-NEXT:    call void @nonstreaming_body()603; CHECK-NEXT:    ret void604;605  call void @nonstreaming_body()606  call void @nonstreaming_body()607  ret void608}609 610; Allow inlining, as inline it would not increase the number of streaming-mode changes.611define void @streaming_caller_to_nonstreaming_callee_with_single_nonstreaming_callee_inline() #0 "aarch64_pstate_sm_enabled" {612; CHECK-LABEL: define void @streaming_caller_to_nonstreaming_callee_with_single_nonstreaming_callee_inline613; CHECK-SAME: () #[[ATTR2]] {614; CHECK-NEXT:    call void @nonstreaming_body()615; CHECK-NEXT:    ret void616;617  call void @nonstreaming_caller_single_nonstreaming_callee()618  ret void619}620 621; Prevent inlining, as inlining it would lead to multiple streaming-mode changes.622define void @streaming_caller_to_nonstreaming_callee_with_multiple_nonstreaming_callees_dont_inline() #0 "aarch64_pstate_sm_enabled" {623; CHECK-LABEL: define void @streaming_caller_to_nonstreaming_callee_with_multiple_nonstreaming_callees_dont_inline624; CHECK-SAME: () #[[ATTR2]] {625; CHECK-NEXT:    call void @streaming_caller_to_nonstreaming_callee_with_multiple_nonstreaming_callees_dont_inline()626; CHECK-NEXT:    ret void627;628  call void @streaming_caller_to_nonstreaming_callee_with_multiple_nonstreaming_callees_dont_inline()629  ret void630}631 632declare void @streaming_compatible_body() "aarch64_pstate_sm_compatible"633 634define void @nonstreaming_caller_single_streaming_compatible_callee() #0 {635; CHECK-LABEL: define void @nonstreaming_caller_single_streaming_compatible_callee636; CHECK-SAME: () #[[ATTR1]] {637; CHECK-NEXT:    call void @streaming_compatible_body()638; CHECK-NEXT:    ret void639;640  call void @streaming_compatible_body()641  ret void642}643 644define void @nonstreaming_caller_multiple_streaming_compatible_callees() #0 {645; CHECK-LABEL: define void @nonstreaming_caller_multiple_streaming_compatible_callees646; CHECK-SAME: () #[[ATTR1]] {647; CHECK-NEXT:    call void @streaming_compatible_body()648; CHECK-NEXT:    call void @streaming_compatible_body()649; CHECK-NEXT:    ret void650;651  call void @streaming_compatible_body()652  call void @streaming_compatible_body()653  ret void654}655 656; Allow inlining, as inline would remove a streaming-mode change.657define void @streaming_caller_to_nonstreaming_callee_with_single_streamingcompatible_callee_inline() #0 "aarch64_pstate_sm_enabled" {658; CHECK-LABEL: define void @streaming_caller_to_nonstreaming_callee_with_single_streamingcompatible_callee_inline659; CHECK-SAME: () #[[ATTR2]] {660; CHECK-NEXT:    call void @streaming_compatible_body()661; CHECK-NEXT:    ret void662;663  call void @nonstreaming_caller_single_streaming_compatible_callee()664  ret void665}666 667; Allow inlining, as inline would remove several streaming-mode changes.668define void @streaming_caller_to_nonstreaming_callee_with_multiple_streamingcompatible_callees_inline() #0 "aarch64_pstate_sm_enabled" {669; CHECK-LABEL: define void @streaming_caller_to_nonstreaming_callee_with_multiple_streamingcompatible_callees_inline670; CHECK-SAME: () #[[ATTR2]] {671; CHECK-NEXT:    call void @streaming_compatible_body()672; CHECK-NEXT:    call void @streaming_compatible_body()673; CHECK-NEXT:    ret void674;675  call void @nonstreaming_caller_multiple_streaming_compatible_callees()676  ret void677}678 679define void @simple_streaming_function(ptr %ptr) #0 "aarch64_pstate_sm_enabled" {680; CHECK-LABEL: define void @simple_streaming_function681; CHECK-SAME: (ptr [[PTR:%.*]]) #[[ATTR2]] {682; CHECK-NEXT:    store <vscale x 4 x i32> zeroinitializer, ptr [[PTR]], align 16683; CHECK-NEXT:    ret void684;685  store <vscale x 4 x i32> zeroinitializer, ptr %ptr686  ret void687}688 689; Don't allow inlining a streaming function into a non-streaming function.690define void @non_streaming_caller_streaming_callee_dont_inline(ptr %ptr) #0 {691; CHECK-LABEL: define void @non_streaming_caller_streaming_callee_dont_inline692; CHECK-SAME: (ptr [[PTR:%.*]]) #[[ATTR1]] {693; CHECK-NEXT:    call void @simple_streaming_function(ptr [[PTR]])694; CHECK-NEXT:    ret void695;696  call void @simple_streaming_function(ptr %ptr)697  ret void698}699 700define void @simple_locally_streaming_function(ptr %ptr) #0 "aarch64_pstate_sm_body" {701; CHECK-LABEL: define void @simple_locally_streaming_function702; CHECK-SAME: (ptr [[PTR:%.*]]) #[[ATTR3]] {703; CHECK-NEXT:    store <vscale x 4 x i32> zeroinitializer, ptr [[PTR]], align 16704; CHECK-NEXT:    ret void705;706  store <vscale x 4 x i32> zeroinitializer, ptr %ptr707  ret void708}709 710; Don't allow inlining a locally-streaming function into a non-streaming function.711define void @non_streaming_caller_locally_streaming_callee_dont_inline(ptr %ptr) #0 {712; CHECK-LABEL: define void @non_streaming_caller_locally_streaming_callee_dont_inline713; CHECK-SAME: (ptr [[PTR:%.*]]) #[[ATTR1]] {714; CHECK-NEXT:    call void @simple_locally_streaming_function(ptr [[PTR]])715; CHECK-NEXT:    ret void716;717  call void @simple_locally_streaming_function(ptr %ptr)718  ret void719}720 721attributes #0 = { "target-features"="+sve,+sme" }722