brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.5 KiB · 787b888 Raw
430 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple arm64e-apple-darwin                          -verify-machineinstrs | FileCheck %s -DL="L"  --check-prefixes=ALL,DARWIN,NOFPAC,DARWIN-NOFPAC3; RUN: llc < %s -mtriple arm64e-apple-darwin             -mattr=+fpac -verify-machineinstrs | FileCheck %s -DL="L"  --check-prefixes=ALL,DARWIN,FPAC,DARWIN-FPAC4; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth              -verify-machineinstrs | FileCheck %s -DL=".L" --check-prefixes=ALL,ELF,NOFPAC,ELF-NOFPAC5; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -mattr=+fpac -verify-machineinstrs | FileCheck %s -DL=".L" --check-prefixes=ALL,ELF,FPAC,ELF-FPAC6 7target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"8 9define i64 @test_auth_ia(i64 %arg, i64 %arg1) {10; DARWIN-LABEL: test_auth_ia:11; DARWIN:       ; %bb.0:12; DARWIN-NEXT:    mov x16, x013; DARWIN-NEXT:    autia x16, x114; DARWIN-NEXT:    mov x0, x1615; DARWIN-NEXT:    ret16;17; ELF-LABEL: test_auth_ia:18; ELF:       // %bb.0:19; ELF-NEXT:    autia x0, x120; ELF-NEXT:    ret21  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 0, i64 %arg1)22  ret i64 %tmp23}24 25define i64 @test_auth_ia_zero(i64 %arg) {26; DARWIN-LABEL: test_auth_ia_zero:27; DARWIN:       ; %bb.0:28; DARWIN-NEXT:    mov x16, x029; DARWIN-NEXT:    autiza x1630; DARWIN-NEXT:    mov x0, x1631; DARWIN-NEXT:    ret32;33; ELF-LABEL: test_auth_ia_zero:34; ELF:       // %bb.0:35; ELF-NEXT:    autiza x036; ELF-NEXT:    ret37  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 0, i64 0)38  ret i64 %tmp39}40 41define i64 @test_auth_ib(i64 %arg, i64 %arg1) {42; DARWIN-LABEL: test_auth_ib:43; DARWIN:       ; %bb.0:44; DARWIN-NEXT:    mov x16, x045; DARWIN-NEXT:    autib x16, x146; DARWIN-NEXT:    mov x0, x1647; DARWIN-NEXT:    ret48;49; ELF-LABEL: test_auth_ib:50; ELF:       // %bb.0:51; ELF-NEXT:    autib x0, x152; ELF-NEXT:    ret53  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 1, i64 %arg1)54  ret i64 %tmp55}56 57define i64 @test_auth_ib_zero(i64 %arg) {58; DARWIN-LABEL: test_auth_ib_zero:59; DARWIN:       ; %bb.0:60; DARWIN-NEXT:    mov x16, x061; DARWIN-NEXT:    autizb x1662; DARWIN-NEXT:    mov x0, x1663; DARWIN-NEXT:    ret64;65; ELF-LABEL: test_auth_ib_zero:66; ELF:       // %bb.0:67; ELF-NEXT:    autizb x068; ELF-NEXT:    ret69  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 1, i64 0)70  ret i64 %tmp71}72 73define i64 @test_auth_da(i64 %arg, i64 %arg1) {74; DARWIN-LABEL: test_auth_da:75; DARWIN:       ; %bb.0:76; DARWIN-NEXT:    mov x16, x077; DARWIN-NEXT:    autda x16, x178; DARWIN-NEXT:    mov x0, x1679; DARWIN-NEXT:    ret80;81; ELF-LABEL: test_auth_da:82; ELF:       // %bb.0:83; ELF-NEXT:    autda x0, x184; ELF-NEXT:    ret85  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 2, i64 %arg1)86  ret i64 %tmp87}88 89define i64 @test_auth_da_zero(i64 %arg) {90; DARWIN-LABEL: test_auth_da_zero:91; DARWIN:       ; %bb.0:92; DARWIN-NEXT:    mov x16, x093; DARWIN-NEXT:    autdza x1694; DARWIN-NEXT:    mov x0, x1695; DARWIN-NEXT:    ret96;97; ELF-LABEL: test_auth_da_zero:98; ELF:       // %bb.0:99; ELF-NEXT:    autdza x0100; ELF-NEXT:    ret101  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 2, i64 0)102  ret i64 %tmp103}104 105define i64 @test_auth_db(i64 %arg, i64 %arg1) {106; DARWIN-LABEL: test_auth_db:107; DARWIN:       ; %bb.0:108; DARWIN-NEXT:    mov x16, x0109; DARWIN-NEXT:    autdb x16, x1110; DARWIN-NEXT:    mov x0, x16111; DARWIN-NEXT:    ret112;113; ELF-LABEL: test_auth_db:114; ELF:       // %bb.0:115; ELF-NEXT:    autdb x0, x1116; ELF-NEXT:    ret117  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 3, i64 %arg1)118  ret i64 %tmp119}120 121define i64 @test_auth_db_zero(i64 %arg) {122; DARWIN-LABEL: test_auth_db_zero:123; DARWIN:       ; %bb.0:124; DARWIN-NEXT:    mov x16, x0125; DARWIN-NEXT:    autdzb x16126; DARWIN-NEXT:    mov x0, x16127; DARWIN-NEXT:    ret128;129; ELF-LABEL: test_auth_db_zero:130; ELF:       // %bb.0:131; ELF-NEXT:    autdzb x0132; ELF-NEXT:    ret133  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 3, i64 0)134  ret i64 %tmp135}136 137; Note that this might seem like a no-op but is actually a valid way to enforce138; the validity of a signature.139define i64 @test_resign_ia_ia(i64 %arg, i64 %arg1, i64 %arg2) {140; NOFPAC-LABEL: test_resign_ia_ia:141; NOFPAC:       %bb.0:142; NOFPAC-NEXT:    mov x16, x0143; NOFPAC-NEXT:    autia x16, x1144; NOFPAC-NEXT:    mov x17, x16145; NOFPAC-NEXT:    xpaci x17146; NOFPAC-NEXT:    cmp x16, x17147; NOFPAC-NEXT:    b.eq [[L]]auth_success_0148; NOFPAC-NEXT:    mov x16, x17149; NOFPAC-NEXT:    b [[L]]resign_end_0150; NOFPAC-NEXT:  Lauth_success_0:151; NOFPAC-NEXT:    pacia x16, x2152; NOFPAC-NEXT:  Lresign_end_0:153; NOFPAC-NEXT:    mov x0, x16154; NOFPAC-NEXT:    ret155;156; FPAC-LABEL: test_resign_ia_ia:157; FPAC:       %bb.0:158; FPAC-NEXT:    mov x16, x0159; FPAC-NEXT:    autia x16, x1160; FPAC-NEXT:    pacia x16, x2161; FPAC-NEXT:    mov x0, x16162; FPAC-NEXT:    ret163  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 0, i64 %arg1, i32 0, i64 %arg2)164  ret i64 %tmp165}166 167define i64 @test_resign_ib_ia(i64 %arg, i64 %arg1, i64 %arg2) {168; NOFPAC-LABEL: test_resign_ib_ia:169; NOFPAC:       %bb.0:170; NOFPAC-NEXT:    mov x16, x0171; NOFPAC-NEXT:    autib x16, x1172; NOFPAC-NEXT:    mov x17, x16173; NOFPAC-NEXT:    xpaci x17174; NOFPAC-NEXT:    cmp x16, x17175; NOFPAC-NEXT:    b.eq [[L]]auth_success_1176; NOFPAC-NEXT:    mov x16, x17177; NOFPAC-NEXT:    b [[L]]resign_end_1178; NOFPAC-NEXT:  Lauth_success_1:179; NOFPAC-NEXT:    pacia x16, x2180; NOFPAC-NEXT:  Lresign_end_1:181; NOFPAC-NEXT:    mov x0, x16182; NOFPAC-NEXT:    ret183;184; FPAC-LABEL: test_resign_ib_ia:185; FPAC:       %bb.0:186; FPAC-NEXT:    mov x16, x0187; FPAC-NEXT:    autib x16, x1188; FPAC-NEXT:    pacia x16, x2189; FPAC-NEXT:    mov x0, x16190; FPAC-NEXT:    ret191  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 1, i64 %arg1, i32 0, i64 %arg2)192  ret i64 %tmp193}194 195define i64 @test_resign_da_ia(i64 %arg, i64 %arg1, i64 %arg2) {196; NOFPAC-LABEL: test_resign_da_ia:197; NOFPAC:       %bb.0:198; NOFPAC-NEXT:    mov x16, x0199; NOFPAC-NEXT:    autda x16, x1200; NOFPAC-NEXT:    mov x17, x16201; NOFPAC-NEXT:    xpacd x17202; NOFPAC-NEXT:    cmp x16, x17203; NOFPAC-NEXT:    b.eq [[L]]auth_success_2204; NOFPAC-NEXT:    mov x16, x17205; NOFPAC-NEXT:    b [[L]]resign_end_2206; NOFPAC-NEXT:  Lauth_success_2:207; NOFPAC-NEXT:    pacia x16, x2208; NOFPAC-NEXT:  Lresign_end_2:209; NOFPAC-NEXT:    mov x0, x16210; NOFPAC-NEXT:    ret211;212; FPAC-LABEL: test_resign_da_ia:213; FPAC:       %bb.0:214; FPAC-NEXT:    mov x16, x0215; FPAC-NEXT:    autda x16, x1216; FPAC-NEXT:    pacia x16, x2217; FPAC-NEXT:    mov x0, x16218; FPAC-NEXT:    ret219  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 2, i64 %arg1, i32 0, i64 %arg2)220  ret i64 %tmp221}222 223define i64 @test_resign_db_ia(i64 %arg, i64 %arg1, i64 %arg2) {224; NOFPAC-LABEL: test_resign_db_ia:225; NOFPAC:       %bb.0:226; NOFPAC-NEXT:    mov x16, x0227; NOFPAC-NEXT:    autdb x16, x1228; NOFPAC-NEXT:    mov x17, x16229; NOFPAC-NEXT:    xpacd x17230; NOFPAC-NEXT:    cmp x16, x17231; NOFPAC-NEXT:    b.eq [[L]]auth_success_3232; NOFPAC-NEXT:    mov x16, x17233; NOFPAC-NEXT:    b [[L]]resign_end_3234; NOFPAC-NEXT:  Lauth_success_3:235; NOFPAC-NEXT:    pacia x16, x2236; NOFPAC-NEXT:  Lresign_end_3:237; NOFPAC-NEXT:    mov x0, x16238; NOFPAC-NEXT:    ret239;240; FPAC-LABEL: test_resign_db_ia:241; FPAC:       %bb.0:242; FPAC-NEXT:    mov x16, x0243; FPAC-NEXT:    autdb x16, x1244; FPAC-NEXT:    pacia x16, x2245; FPAC-NEXT:    mov x0, x16246; FPAC-NEXT:    ret247  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 3, i64 %arg1, i32 0, i64 %arg2)248  ret i64 %tmp249}250 251define i64 @test_resign_db_ib(i64 %arg, i64 %arg1, i64 %arg2) {252; NOFPAC-LABEL: test_resign_db_ib:253; NOFPAC:       %bb.0:254; NOFPAC-NEXT:    mov x16, x0255; NOFPAC-NEXT:    autdb x16, x1256; NOFPAC-NEXT:    mov x17, x16257; NOFPAC-NEXT:    xpacd x17258; NOFPAC-NEXT:    cmp x16, x17259; NOFPAC-NEXT:    b.eq [[L]]auth_success_4260; NOFPAC-NEXT:    mov x16, x17261; NOFPAC-NEXT:    b [[L]]resign_end_4262; NOFPAC-NEXT:  Lauth_success_4:263; NOFPAC-NEXT:    pacib x16, x2264; NOFPAC-NEXT:  Lresign_end_4:265; NOFPAC-NEXT:    mov x0, x16266; NOFPAC-NEXT:    ret267;268; FPAC-LABEL: test_resign_db_ib:269; FPAC:       %bb.0:270; FPAC-NEXT:    mov x16, x0271; FPAC-NEXT:    autdb x16, x1272; FPAC-NEXT:    pacib x16, x2273; FPAC-NEXT:    mov x0, x16274; FPAC-NEXT:    ret275  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 3, i64 %arg1, i32 1, i64 %arg2)276  ret i64 %tmp277}278 279define i64 @test_resign_db_da(i64 %arg, i64 %arg1, i64 %arg2) {280; NOFPAC-LABEL: test_resign_db_da:281; NOFPAC:       %bb.0:282; NOFPAC-NEXT:    mov x16, x0283; NOFPAC-NEXT:    autdb x16, x1284; NOFPAC-NEXT:    mov x17, x16285; NOFPAC-NEXT:    xpacd x17286; NOFPAC-NEXT:    cmp x16, x17287; NOFPAC-NEXT:    b.eq [[L]]auth_success_5288; NOFPAC-NEXT:    mov x16, x17289; NOFPAC-NEXT:    b [[L]]resign_end_5290; NOFPAC-NEXT:  Lauth_success_5:291; NOFPAC-NEXT:    pacda x16, x2292; NOFPAC-NEXT:  Lresign_end_5:293; NOFPAC-NEXT:    mov x0, x16294; NOFPAC-NEXT:    ret295;296; FPAC-LABEL: test_resign_db_da:297; FPAC:       %bb.0:298; FPAC-NEXT:    mov x16, x0299; FPAC-NEXT:    autdb x16, x1300; FPAC-NEXT:    pacda x16, x2301; FPAC-NEXT:    mov x0, x16302; FPAC-NEXT:    ret303  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 3, i64 %arg1, i32 2, i64 %arg2)304  ret i64 %tmp305}306 307define i64 @test_resign_db_db(i64 %arg, i64 %arg1, i64 %arg2) {308; NOFPAC-LABEL: test_resign_db_db:309; NOFPAC:       %bb.0:310; NOFPAC-NEXT:    mov x16, x0311; NOFPAC-NEXT:    autdb x16, x1312; NOFPAC-NEXT:    mov x17, x16313; NOFPAC-NEXT:    xpacd x17314; NOFPAC-NEXT:    cmp x16, x17315; NOFPAC-NEXT:    b.eq [[L]]auth_success_6316; NOFPAC-NEXT:    mov x16, x17317; NOFPAC-NEXT:    b [[L]]resign_end_6318; NOFPAC-NEXT:  Lauth_success_6:319; NOFPAC-NEXT:    pacdb x16, x2320; NOFPAC-NEXT:  Lresign_end_6:321; NOFPAC-NEXT:    mov x0, x16322; NOFPAC-NEXT:    ret323;324; FPAC-LABEL: test_resign_db_db:325; FPAC:       %bb.0:326; FPAC-NEXT:    mov x16, x0327; FPAC-NEXT:    autdb x16, x1328; FPAC-NEXT:    pacdb x16, x2329; FPAC-NEXT:    mov x0, x16330; FPAC-NEXT:    ret331  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 3, i64 %arg1, i32 3, i64 %arg2)332  ret i64 %tmp333}334 335define i64 @test_resign_iza_db(i64 %arg, i64 %arg1, i64 %arg2) {336; NOFPAC-LABEL: test_resign_iza_db:337; NOFPAC:       %bb.0:338; NOFPAC-NEXT:    mov x16, x0339; NOFPAC-NEXT:    autiza x16340; NOFPAC-NEXT:    mov x17, x16341; NOFPAC-NEXT:    xpaci x17342; NOFPAC-NEXT:    cmp x16, x17343; NOFPAC-NEXT:    b.eq [[L]]auth_success_7344; NOFPAC-NEXT:    mov x16, x17345; NOFPAC-NEXT:    b [[L]]resign_end_7346; NOFPAC-NEXT:  Lauth_success_7:347; NOFPAC-NEXT:    pacdb x16, x2348; NOFPAC-NEXT:  Lresign_end_7:349; NOFPAC-NEXT:    mov x0, x16350; NOFPAC-NEXT:    ret351;352; FPAC-LABEL: test_resign_iza_db:353; FPAC:       %bb.0:354; FPAC-NEXT:    mov x16, x0355; FPAC-NEXT:    autiza x16356; FPAC-NEXT:    pacdb x16, x2357; FPAC-NEXT:    mov x0, x16358; FPAC-NEXT:    ret359  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 0, i64 0, i32 3, i64 %arg2)360  ret i64 %tmp361}362 363define i64 @test_resign_da_dzb(i64 %arg, i64 %arg1, i64 %arg2) {364; NOFPAC-LABEL: test_resign_da_dzb:365; NOFPAC:       %bb.0:366; NOFPAC-NEXT:    mov x16, x0367; NOFPAC-NEXT:    autda x16, x1368; NOFPAC-NEXT:    mov x17, x16369; NOFPAC-NEXT:    xpacd x17370; NOFPAC-NEXT:    cmp x16, x17371; NOFPAC-NEXT:    b.eq [[L]]auth_success_8372; NOFPAC-NEXT:    mov x16, x17373; NOFPAC-NEXT:    b [[L]]resign_end_8374; NOFPAC-NEXT:  Lauth_success_8:375; NOFPAC-NEXT:    pacdzb x16376; NOFPAC-NEXT:  Lresign_end_8:377; NOFPAC-NEXT:    mov x0, x16378; NOFPAC-NEXT:    ret379;380; FPAC-LABEL: test_resign_da_dzb:381; FPAC:       %bb.0:382; FPAC-NEXT:    mov x16, x0383; FPAC-NEXT:    autda x16, x1384; FPAC-NEXT:    pacdzb x16385; FPAC-NEXT:    mov x0, x16386; FPAC-NEXT:    ret387  %tmp = call i64 @llvm.ptrauth.resign(i64 %arg, i32 2, i64 %arg1, i32 3, i64 0)388  ret i64 %tmp389}390 391define i64 @test_auth_trap_attribute(i64 %arg, i64 %arg1) "ptrauth-auth-traps" {392; ALL-LABEL: test_auth_trap_attribute:393; DARWIN-NOFPAC:       %bb.0:394; DARWIN-NOFPAC-NEXT:    mov x16, x0395; DARWIN-NOFPAC-NEXT:    autia x16, x1396; DARWIN-NOFPAC-NEXT:    mov x17, x16397; DARWIN-NOFPAC-NEXT:    xpaci x17398; DARWIN-NOFPAC-NEXT:    cmp x16, x17399; DARWIN-NOFPAC-NEXT:    b.eq [[L]]auth_success_9400; DARWIN-NOFPAC-NEXT:    brk #0xc470401; DARWIN-NOFPAC-NEXT:  Lauth_success_9:402; DARWIN-NOFPAC-NEXT:    mov x0, x16403; DARWIN-NOFPAC-NEXT:    ret404;405; ELF-NOFPAC:       %bb.0:406; ELF-NOFPAC-NEXT:    autia x0, x1407; ELF-NOFPAC-NEXT:    mov x8, x0408; ELF-NOFPAC-NEXT:    xpaci x8409; ELF-NOFPAC-NEXT:    cmp x0, x8410; ELF-NOFPAC-NEXT:    b.eq [[L]]auth_success_9411; ELF-NOFPAC-NEXT:    brk #0xc470412; ELF-NOFPAC-NEXT:  Lauth_success_9:413; ELF-NOFPAC-NEXT:    ret414;415; DARWIN-FPAC:       %bb.0:416; DARWIN-FPAC-NEXT:    mov x16, x0417; DARWIN-FPAC-NEXT:    autia x16, x1418; DARWIN-FPAC-NEXT:    mov x0, x16419; DARWIN-FPAC-NEXT:    ret420;421; ELF-FPAC:       %bb.0:422; ELF-FPAC-NEXT:    autia x0, x1423; ELF-FPAC-NEXT:    ret424  %tmp = call i64 @llvm.ptrauth.auth(i64 %arg, i32 0, i64 %arg1)425  ret i64 %tmp426}427 428declare i64 @llvm.ptrauth.auth(i64, i32, i64)429declare i64 @llvm.ptrauth.resign(i64, i32, i64, i32, i64)430