211 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -verify-machineinstrs -mtriple x86_64-linux < %s | FileCheck %s3; RUN: llc -verify-machineinstrs -mtriple x86_64-windows < %s | FileCheck %s --check-prefix=WIN644 5declare i64 @llvm.x86.flags.read.u64()6declare void @llvm.x86.flags.write.u64(i64)7 8define i64 @read_flags() {9; CHECK-LABEL: read_flags:10; CHECK: # %bb.0: # %entry11; CHECK-NEXT: pushfq12; CHECK-NEXT: popq %rax13; CHECK-NEXT: retq14;15; WIN64-LABEL: read_flags:16; WIN64: # %bb.0: # %entry17; WIN64-NEXT: pushq %rbp18; WIN64-NEXT: .seh_pushreg %rbp19; WIN64-NEXT: movq %rsp, %rbp20; WIN64-NEXT: .seh_setframe %rbp, 021; WIN64-NEXT: .seh_endprologue22; WIN64-NEXT: pushfq23; WIN64-NEXT: popq %rax24; WIN64-NEXT: .seh_startepilogue25; WIN64-NEXT: popq %rbp26; WIN64-NEXT: .seh_endepilogue27; WIN64-NEXT: retq28; WIN64-NEXT: .seh_endproc29entry:30 %flags = call i64 @llvm.x86.flags.read.u64()31 ret i64 %flags32}33 34define void @write_flags(i64 %arg) {35; CHECK-LABEL: write_flags:36; CHECK: # %bb.0: # %entry37; CHECK-NEXT: pushq %rdi38; CHECK-NEXT: popfq39; CHECK-NEXT: retq40;41; WIN64-LABEL: write_flags:42; WIN64: # %bb.0: # %entry43; WIN64-NEXT: pushq %rbp44; WIN64-NEXT: .seh_pushreg %rbp45; WIN64-NEXT: movq %rsp, %rbp46; WIN64-NEXT: .seh_setframe %rbp, 047; WIN64-NEXT: .seh_endprologue48; WIN64-NEXT: pushq %rcx49; WIN64-NEXT: popfq50; WIN64-NEXT: .seh_startepilogue51; WIN64-NEXT: popq %rbp52; WIN64-NEXT: .seh_endepilogue53; WIN64-NEXT: retq54; WIN64-NEXT: .seh_endproc55entry:56 call void @llvm.x86.flags.write.u64(i64 %arg)57 ret void58}59 60define i64 @read_flags_reg_pressure() nounwind {61; CHECK-LABEL: read_flags_reg_pressure:62; CHECK: # %bb.0:63; CHECK-NEXT: pushq %rbp64; CHECK-NEXT: pushq %r1565; CHECK-NEXT: pushq %r1466; CHECK-NEXT: pushq %r1367; CHECK-NEXT: pushq %r1268; CHECK-NEXT: pushq %rbx69; CHECK-NEXT: #APP70; CHECK-NEXT: #NO_APP71; CHECK-NEXT: pushfq72; CHECK-NEXT: popq %rbp73; CHECK-NEXT: #APP74; CHECK-NEXT: #NO_APP75; CHECK-NEXT: movq %rbp, %rax76; CHECK-NEXT: popq %rbx77; CHECK-NEXT: popq %r1278; CHECK-NEXT: popq %r1379; CHECK-NEXT: popq %r1480; CHECK-NEXT: popq %r1581; CHECK-NEXT: popq %rbp82; CHECK-NEXT: retq83;84; WIN64-LABEL: read_flags_reg_pressure:85; WIN64: # %bb.0:86; WIN64-NEXT: pushq %rbp87; WIN64-NEXT: pushq %r1588; WIN64-NEXT: pushq %r1489; WIN64-NEXT: pushq %r1390; WIN64-NEXT: pushq %r1291; WIN64-NEXT: pushq %rsi92; WIN64-NEXT: pushq %rdi93; WIN64-NEXT: pushq %rbx94; WIN64-NEXT: subq $16, %rsp95; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rbp96; WIN64-NEXT: #APP97; WIN64-NEXT: #NO_APP98; WIN64-NEXT: movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill99; WIN64-NEXT: pushfq100; WIN64-NEXT: popq %rdx101; WIN64-NEXT: movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill102; WIN64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload103; WIN64-NEXT: #APP104; WIN64-NEXT: #NO_APP105; WIN64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload106; WIN64-NEXT: addq $16, %rsp107; WIN64-NEXT: popq %rbx108; WIN64-NEXT: popq %rdi109; WIN64-NEXT: popq %rsi110; WIN64-NEXT: popq %r12111; WIN64-NEXT: popq %r13112; WIN64-NEXT: popq %r14113; WIN64-NEXT: popq %r15114; WIN64-NEXT: popq %rbp115; WIN64-NEXT: retq116 %1 = tail call { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } asm sideeffect "", "={ax},={bx},={cx},={dx},={si},={di},={r8},={r9},={r10},={r11},={r12},={r13},={r14},={r15},~{dirflag},~{fpsr},~{flags}"()117 %2 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 0118 %3 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 1119 %4 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 2120 %5 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 3121 %6 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 4122 %7 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 5123 %8 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 6124 %9 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 7125 %10 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 8126 %11 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 9127 %12 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 10128 %13 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 11129 %14 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 12130 %15 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %1, 13131 %flags = tail call i64 @llvm.x86.flags.read.u64()132 tail call void asm sideeffect "", "{ax},{bx},{cx},{dx},{si},{di},{r8},{r9},{r10},{r11},{r12},{r13},{r14},{r15},~{dirflag},~{fpsr},~{flags}"(i64 %2, i64 %3, i64 %4, i64 %5, i64 %6, i64 %7, i64 %8, i64 %9, i64 %10, i64 %11, i64 %12, i64 %13, i64 %14, i64 %15)133 ret i64 %flags134}135 136define void @write_flags_reg_pressure(i64 noundef %0) nounwind {137; CHECK-LABEL: write_flags_reg_pressure:138; CHECK: # %bb.0:139; CHECK-NEXT: pushq %rbp140; CHECK-NEXT: pushq %r15141; CHECK-NEXT: pushq %r14142; CHECK-NEXT: pushq %r13143; CHECK-NEXT: pushq %r12144; CHECK-NEXT: pushq %rbx145; CHECK-NEXT: movq %rdi, %rbp146; CHECK-NEXT: #APP147; CHECK-NEXT: #NO_APP148; CHECK-NEXT: pushq %rbp149; CHECK-NEXT: popfq150; CHECK-NEXT: #APP151; CHECK-NEXT: #NO_APP152; CHECK-NEXT: popq %rbx153; CHECK-NEXT: popq %r12154; CHECK-NEXT: popq %r13155; CHECK-NEXT: popq %r14156; CHECK-NEXT: popq %r15157; CHECK-NEXT: popq %rbp158; CHECK-NEXT: retq159;160; WIN64-LABEL: write_flags_reg_pressure:161; WIN64: # %bb.0:162; WIN64-NEXT: pushq %rbp163; WIN64-NEXT: pushq %r15164; WIN64-NEXT: pushq %r14165; WIN64-NEXT: pushq %r13166; WIN64-NEXT: pushq %r12167; WIN64-NEXT: pushq %rsi168; WIN64-NEXT: pushq %rdi169; WIN64-NEXT: pushq %rbx170; WIN64-NEXT: subq $16, %rsp171; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rbp172; WIN64-NEXT: movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill173; WIN64-NEXT: #APP174; WIN64-NEXT: #NO_APP175; WIN64-NEXT: movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill176; WIN64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload177; WIN64-NEXT: pushq %rdx178; WIN64-NEXT: popfq179; WIN64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload180; WIN64-NEXT: #APP181; WIN64-NEXT: #NO_APP182; WIN64-NEXT: addq $16, %rsp183; WIN64-NEXT: popq %rbx184; WIN64-NEXT: popq %rdi185; WIN64-NEXT: popq %rsi186; WIN64-NEXT: popq %r12187; WIN64-NEXT: popq %r13188; WIN64-NEXT: popq %r14189; WIN64-NEXT: popq %r15190; WIN64-NEXT: popq %rbp191; WIN64-NEXT: retq192 %2 = tail call { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } asm sideeffect "", "={ax},={bx},={cx},={dx},={si},={di},={r8},={r9},={r10},={r11},={r12},={r13},={r14},={r15},~{dirflag},~{fpsr},~{flags}"()193 %3 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 0194 %4 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 1195 %5 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 2196 %6 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 3197 %7 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 4198 %8 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 5199 %9 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 6200 %10 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 7201 %11 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 8202 %12 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 9203 %13 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 10204 %14 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 11205 %15 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 12206 %16 = extractvalue { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 } %2, 13207 tail call void @llvm.x86.flags.write.u64(i64 %0)208 tail call void asm sideeffect "", "{ax},{bx},{cx},{dx},{si},{di},{r8},{r9},{r10},{r11},{r12},{r13},{r14},{r15},~{dirflag},~{fpsr},~{flags}"(i64 %3, i64 %4, i64 %5, i64 %6, i64 %7, i64 %8, i64 %9, i64 %10, i64 %11, i64 %12, i64 %13, i64 %14, i64 %15, i64 %16)209 ret void210}211