637 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=mips-unknown-linux-gnu -mcpu=mips2 | FileCheck %s \3; RUN: -check-prefix=MIPS4; RUN: llc < %s -mtriple=mips-unknown-linux-gnu -mcpu=mips32 | FileCheck %s \5; RUN: -check-prefix=MIPS6; RUN: llc < %s -mtriple=mips-unknown-linux-gnu -mcpu=mips32r2 | FileCheck %s \7; RUN: -check-prefix=MIPS32R28; RUN: llc < %s -mtriple=mips-unknown-linux-gnu -mcpu=mips32r3 | FileCheck %s \9; RUN: -check-prefix=MIPS32R210; RUN: llc < %s -mtriple=mips-unknown-linux-gnu -mcpu=mips32r5 | FileCheck %s \11; RUN: -check-prefix=MIPS32R212; RUN: llc < %s -mtriple=mips-unknown-linux-gnu -mcpu=mips32r6 | FileCheck %s \13; RUN: -check-prefix=MIPS32R614; RUN: llc < %s -mtriple=mips64-unknown-linux-gnu -mcpu=mips3 | FileCheck %s \15; RUN: -check-prefix=MIPS6416; RUN: llc < %s -mtriple=mips64-unknown-linux-gnu -mcpu=mips4 | FileCheck %s \17; RUN: -check-prefix=MIPS6418; RUN: llc < %s -mtriple=mips64-unknown-linux-gnu -mcpu=mips64 | FileCheck %s \19; RUN: -check-prefix=MIPS6420; RUN: llc < %s -mtriple=mips64-unknown-linux-gnu -mcpu=mips64r2 | FileCheck %s \21; RUN: -check-prefix=MIPS64R222; RUN: llc < %s -mtriple=mips64-unknown-linux-gnu -mcpu=mips64r3 | FileCheck %s \23; RUN: -check-prefix=MIPS64R224; RUN: llc < %s -mtriple=mips64-unknown-linux-gnu -mcpu=mips64r5 | FileCheck %s \25; RUN: -check-prefix=MIPS64R226; RUN: llc < %s -mtriple=mips64-unknown-linux-gnu -mcpu=mips64r6 | FileCheck %s \27; RUN: -check-prefix=MIPS64R628; RUN: llc < %s -mtriple=mips-unknown-linux-gnu -mcpu=mips32r3 -mattr=+micromips | FileCheck %s \29; RUN: -check-prefix=MM32R330; RUN: llc < %s -mtriple=mips-unknown-linux-gnu -mcpu=mips32r6 -mattr=+micromips | FileCheck %s \31; RUN: -check-prefix=MM32R632 33define signext i32 @bittest_10_i32(i32 signext %a) nounwind {34; MIPS-LABEL: bittest_10_i32:35; MIPS: # %bb.0:36; MIPS-NEXT: andi $1, $4, 102437; MIPS-NEXT: jr $ra38; MIPS-NEXT: sltiu $2, $1, 139;40; MIPS32R2-LABEL: bittest_10_i32:41; MIPS32R2: # %bb.0:42; MIPS32R2-NEXT: andi $1, $4, 102443; MIPS32R2-NEXT: jr $ra44; MIPS32R2-NEXT: sltiu $2, $1, 145;46; MIPS32R6-LABEL: bittest_10_i32:47; MIPS32R6: # %bb.0:48; MIPS32R6-NEXT: andi $1, $4, 102449; MIPS32R6-NEXT: jr $ra50; MIPS32R6-NEXT: sltiu $2, $1, 151;52; MIPS64-LABEL: bittest_10_i32:53; MIPS64: # %bb.0:54; MIPS64-NEXT: andi $1, $4, 102455; MIPS64-NEXT: sltiu $1, $1, 156; MIPS64-NEXT: jr $ra57; MIPS64-NEXT: sll $2, $1, 058;59; MIPS64R2-LABEL: bittest_10_i32:60; MIPS64R2: # %bb.0:61; MIPS64R2-NEXT: andi $1, $4, 102462; MIPS64R2-NEXT: sltiu $1, $1, 163; MIPS64R2-NEXT: jr $ra64; MIPS64R2-NEXT: sll $2, $1, 065;66; MIPS64R6-LABEL: bittest_10_i32:67; MIPS64R6: # %bb.0:68; MIPS64R6-NEXT: andi $1, $4, 102469; MIPS64R6-NEXT: sltiu $1, $1, 170; MIPS64R6-NEXT: jr $ra71; MIPS64R6-NEXT: sll $2, $1, 072;73; MM32R3-LABEL: bittest_10_i32:74; MM32R3: # %bb.0:75; MM32R3-NEXT: andi $1, $4, 102476; MM32R3-NEXT: jr $ra77; MM32R3-NEXT: sltiu $2, $1, 178;79; MM32R6-LABEL: bittest_10_i32:80; MM32R6: # %bb.0:81; MM32R6-NEXT: andi $1, $4, 102482; MM32R6-NEXT: sltiu $2, $1, 183; MM32R6-NEXT: jrc $ra84 %shr = lshr i32 %a, 1085 %not = xor i32 %shr, -186 %and = and i32 %not, 187 ret i32 %and88}89 90define signext i32 @bittest_15_i32(i32 signext %a) nounwind {91; MIPS-LABEL: bittest_15_i32:92; MIPS: # %bb.0:93; MIPS-NEXT: andi $1, $4, 3276894; MIPS-NEXT: jr $ra95; MIPS-NEXT: sltiu $2, $1, 196;97; MIPS32R2-LABEL: bittest_15_i32:98; MIPS32R2: # %bb.0:99; MIPS32R2-NEXT: andi $1, $4, 32768100; MIPS32R2-NEXT: jr $ra101; MIPS32R2-NEXT: sltiu $2, $1, 1102;103; MIPS32R6-LABEL: bittest_15_i32:104; MIPS32R6: # %bb.0:105; MIPS32R6-NEXT: andi $1, $4, 32768106; MIPS32R6-NEXT: jr $ra107; MIPS32R6-NEXT: sltiu $2, $1, 1108;109; MIPS64-LABEL: bittest_15_i32:110; MIPS64: # %bb.0:111; MIPS64-NEXT: andi $1, $4, 32768112; MIPS64-NEXT: sltiu $1, $1, 1113; MIPS64-NEXT: jr $ra114; MIPS64-NEXT: sll $2, $1, 0115;116; MIPS64R2-LABEL: bittest_15_i32:117; MIPS64R2: # %bb.0:118; MIPS64R2-NEXT: andi $1, $4, 32768119; MIPS64R2-NEXT: sltiu $1, $1, 1120; MIPS64R2-NEXT: jr $ra121; MIPS64R2-NEXT: sll $2, $1, 0122;123; MIPS64R6-LABEL: bittest_15_i32:124; MIPS64R6: # %bb.0:125; MIPS64R6-NEXT: andi $1, $4, 32768126; MIPS64R6-NEXT: sltiu $1, $1, 1127; MIPS64R6-NEXT: jr $ra128; MIPS64R6-NEXT: sll $2, $1, 0129;130; MM32R3-LABEL: bittest_15_i32:131; MM32R3: # %bb.0:132; MM32R3-NEXT: andi16 $2, $4, 32768133; MM32R3-NEXT: jr $ra134; MM32R3-NEXT: sltiu $2, $2, 1135;136; MM32R6-LABEL: bittest_15_i32:137; MM32R6: # %bb.0:138; MM32R6-NEXT: andi16 $2, $4, 32768139; MM32R6-NEXT: sltiu $2, $2, 1140; MM32R6-NEXT: jrc $ra141 %shr = lshr i32 %a, 15142 %not = xor i32 %shr, -1143 %and = and i32 %not, 1144 ret i32 %and145}146 147define signext i32 @bittest_16_i32(i32 signext %a) nounwind {148; MIPS-LABEL: bittest_16_i32:149; MIPS: # %bb.0:150; MIPS-NEXT: not $1, $4151; MIPS-NEXT: srl $1, $1, 16152; MIPS-NEXT: jr $ra153; MIPS-NEXT: andi $2, $1, 1154;155; MIPS32R2-LABEL: bittest_16_i32:156; MIPS32R2: # %bb.0:157; MIPS32R2-NEXT: not $1, $4158; MIPS32R2-NEXT: jr $ra159; MIPS32R2-NEXT: ext $2, $1, 16, 1160;161; MIPS32R6-LABEL: bittest_16_i32:162; MIPS32R6: # %bb.0:163; MIPS32R6-NEXT: not $1, $4164; MIPS32R6-NEXT: jr $ra165; MIPS32R6-NEXT: ext $2, $1, 16, 1166;167; MIPS64-LABEL: bittest_16_i32:168; MIPS64: # %bb.0:169; MIPS64-NEXT: not $1, $4170; MIPS64-NEXT: srl $1, $1, 16171; MIPS64-NEXT: andi $1, $1, 1172; MIPS64-NEXT: jr $ra173; MIPS64-NEXT: sll $2, $1, 0174;175; MIPS64R2-LABEL: bittest_16_i32:176; MIPS64R2: # %bb.0:177; MIPS64R2-NEXT: not $1, $4178; MIPS64R2-NEXT: ext $1, $1, 16, 1179; MIPS64R2-NEXT: jr $ra180; MIPS64R2-NEXT: sll $2, $1, 0181;182; MIPS64R6-LABEL: bittest_16_i32:183; MIPS64R6: # %bb.0:184; MIPS64R6-NEXT: not $1, $4185; MIPS64R6-NEXT: ext $1, $1, 16, 1186; MIPS64R6-NEXT: jr $ra187; MIPS64R6-NEXT: sll $2, $1, 0188;189; MM32R3-LABEL: bittest_16_i32:190; MM32R3: # %bb.0:191; MM32R3-NEXT: not16 $2, $4192; MM32R3-NEXT: jr $ra193; MM32R3-NEXT: ext $2, $2, 16, 1194;195; MM32R6-LABEL: bittest_16_i32:196; MM32R6: # %bb.0:197; MM32R6-NEXT: not16 $2, $4198; MM32R6-NEXT: ext $2, $2, 16, 1199; MM32R6-NEXT: jrc $ra200 %shr = lshr i32 %a, 16201 %not = xor i32 %shr, -1202 %and = and i32 %not, 1203 ret i32 %and204}205 206define signext i32 @bittest_31_i32(i32 signext %a) nounwind {207; MIPS-LABEL: bittest_31_i32:208; MIPS: # %bb.0:209; MIPS-NEXT: not $1, $4210; MIPS-NEXT: jr $ra211; MIPS-NEXT: srl $2, $1, 31212;213; MIPS32R2-LABEL: bittest_31_i32:214; MIPS32R2: # %bb.0:215; MIPS32R2-NEXT: not $1, $4216; MIPS32R2-NEXT: jr $ra217; MIPS32R2-NEXT: srl $2, $1, 31218;219; MIPS32R6-LABEL: bittest_31_i32:220; MIPS32R6: # %bb.0:221; MIPS32R6-NEXT: not $1, $4222; MIPS32R6-NEXT: jr $ra223; MIPS32R6-NEXT: srl $2, $1, 31224;225; MIPS64-LABEL: bittest_31_i32:226; MIPS64: # %bb.0:227; MIPS64-NEXT: not $1, $4228; MIPS64-NEXT: jr $ra229; MIPS64-NEXT: srl $2, $1, 31230;231; MIPS64R2-LABEL: bittest_31_i32:232; MIPS64R2: # %bb.0:233; MIPS64R2-NEXT: not $1, $4234; MIPS64R2-NEXT: jr $ra235; MIPS64R2-NEXT: srl $2, $1, 31236;237; MIPS64R6-LABEL: bittest_31_i32:238; MIPS64R6: # %bb.0:239; MIPS64R6-NEXT: not $1, $4240; MIPS64R6-NEXT: jr $ra241; MIPS64R6-NEXT: srl $2, $1, 31242;243; MM32R3-LABEL: bittest_31_i32:244; MM32R3: # %bb.0:245; MM32R3-NEXT: not16 $2, $4246; MM32R3-NEXT: jr $ra247; MM32R3-NEXT: srl $2, $2, 31248;249; MM32R6-LABEL: bittest_31_i32:250; MM32R6: # %bb.0:251; MM32R6-NEXT: not16 $2, $4252; MM32R6-NEXT: srl $2, $2, 31253; MM32R6-NEXT: jrc $ra254 %shr = lshr i32 %a, 31255 %not = xor i32 %shr, -1256 %and = and i32 %not, 1257 ret i32 %and258}259 260define i64 @bittest_10_i64(i64 %a) nounwind {261; MIPS-LABEL: bittest_10_i64:262; MIPS: # %bb.0:263; MIPS-NEXT: andi $1, $5, 1024264; MIPS-NEXT: sltiu $3, $1, 1265; MIPS-NEXT: jr $ra266; MIPS-NEXT: addiu $2, $zero, 0267;268; MIPS32R2-LABEL: bittest_10_i64:269; MIPS32R2: # %bb.0:270; MIPS32R2-NEXT: andi $1, $5, 1024271; MIPS32R2-NEXT: sltiu $3, $1, 1272; MIPS32R2-NEXT: jr $ra273; MIPS32R2-NEXT: addiu $2, $zero, 0274;275; MIPS32R6-LABEL: bittest_10_i64:276; MIPS32R6: # %bb.0:277; MIPS32R6-NEXT: andi $1, $5, 1024278; MIPS32R6-NEXT: sltiu $3, $1, 1279; MIPS32R6-NEXT: jr $ra280; MIPS32R6-NEXT: addiu $2, $zero, 0281;282; MIPS64-LABEL: bittest_10_i64:283; MIPS64: # %bb.0:284; MIPS64-NEXT: andi $1, $4, 1024285; MIPS64-NEXT: sltiu $1, $1, 1286; MIPS64-NEXT: dsll $1, $1, 32287; MIPS64-NEXT: jr $ra288; MIPS64-NEXT: dsrl $2, $1, 32289;290; MIPS64R2-LABEL: bittest_10_i64:291; MIPS64R2: # %bb.0:292; MIPS64R2-NEXT: andi $1, $4, 1024293; MIPS64R2-NEXT: sltiu $1, $1, 1294; MIPS64R2-NEXT: jr $ra295; MIPS64R2-NEXT: dext $2, $1, 0, 32296;297; MIPS64R6-LABEL: bittest_10_i64:298; MIPS64R6: # %bb.0:299; MIPS64R6-NEXT: andi $1, $4, 1024300; MIPS64R6-NEXT: sltiu $1, $1, 1301; MIPS64R6-NEXT: jr $ra302; MIPS64R6-NEXT: dext $2, $1, 0, 32303;304; MM32R3-LABEL: bittest_10_i64:305; MM32R3: # %bb.0:306; MM32R3-NEXT: andi $1, $5, 1024307; MM32R3-NEXT: li16 $2, 0308; MM32R3-NEXT: jr $ra309; MM32R3-NEXT: sltiu $3, $1, 1310;311; MM32R6-LABEL: bittest_10_i64:312; MM32R6: # %bb.0:313; MM32R6-NEXT: andi $1, $5, 1024314; MM32R6-NEXT: sltiu $3, $1, 1315; MM32R6-NEXT: li16 $2, 0316; MM32R6-NEXT: jrc $ra317 %shr = lshr i64 %a, 10318 %not = xor i64 %shr, -1319 %and = and i64 %not, 1320 ret i64 %and321}322 323define i64 @bittest_15_i64(i64 %a) nounwind {324; MIPS-LABEL: bittest_15_i64:325; MIPS: # %bb.0:326; MIPS-NEXT: andi $1, $5, 32768327; MIPS-NEXT: sltiu $3, $1, 1328; MIPS-NEXT: jr $ra329; MIPS-NEXT: addiu $2, $zero, 0330;331; MIPS32R2-LABEL: bittest_15_i64:332; MIPS32R2: # %bb.0:333; MIPS32R2-NEXT: andi $1, $5, 32768334; MIPS32R2-NEXT: sltiu $3, $1, 1335; MIPS32R2-NEXT: jr $ra336; MIPS32R2-NEXT: addiu $2, $zero, 0337;338; MIPS32R6-LABEL: bittest_15_i64:339; MIPS32R6: # %bb.0:340; MIPS32R6-NEXT: andi $1, $5, 32768341; MIPS32R6-NEXT: sltiu $3, $1, 1342; MIPS32R6-NEXT: jr $ra343; MIPS32R6-NEXT: addiu $2, $zero, 0344;345; MIPS64-LABEL: bittest_15_i64:346; MIPS64: # %bb.0:347; MIPS64-NEXT: andi $1, $4, 32768348; MIPS64-NEXT: sltiu $1, $1, 1349; MIPS64-NEXT: dsll $1, $1, 32350; MIPS64-NEXT: jr $ra351; MIPS64-NEXT: dsrl $2, $1, 32352;353; MIPS64R2-LABEL: bittest_15_i64:354; MIPS64R2: # %bb.0:355; MIPS64R2-NEXT: andi $1, $4, 32768356; MIPS64R2-NEXT: sltiu $1, $1, 1357; MIPS64R2-NEXT: jr $ra358; MIPS64R2-NEXT: dext $2, $1, 0, 32359;360; MIPS64R6-LABEL: bittest_15_i64:361; MIPS64R6: # %bb.0:362; MIPS64R6-NEXT: andi $1, $4, 32768363; MIPS64R6-NEXT: sltiu $1, $1, 1364; MIPS64R6-NEXT: jr $ra365; MIPS64R6-NEXT: dext $2, $1, 0, 32366;367; MM32R3-LABEL: bittest_15_i64:368; MM32R3: # %bb.0:369; MM32R3-NEXT: andi16 $2, $5, 32768370; MM32R3-NEXT: sltiu $3, $2, 1371; MM32R3-NEXT: li16 $2, 0372; MM32R3-NEXT: jrc $ra373;374; MM32R6-LABEL: bittest_15_i64:375; MM32R6: # %bb.0:376; MM32R6-NEXT: andi16 $2, $5, 32768377; MM32R6-NEXT: sltiu $3, $2, 1378; MM32R6-NEXT: li16 $2, 0379; MM32R6-NEXT: jrc $ra380 %shr = lshr i64 %a, 15381 %not = xor i64 %shr, -1382 %and = and i64 %not, 1383 ret i64 %and384}385 386define i64 @bittest_16_i64(i64 %a) nounwind {387; MIPS-LABEL: bittest_16_i64:388; MIPS: # %bb.0:389; MIPS-NEXT: not $1, $5390; MIPS-NEXT: srl $1, $1, 16391; MIPS-NEXT: andi $3, $1, 1392; MIPS-NEXT: jr $ra393; MIPS-NEXT: addiu $2, $zero, 0394;395; MIPS32R2-LABEL: bittest_16_i64:396; MIPS32R2: # %bb.0:397; MIPS32R2-NEXT: not $1, $5398; MIPS32R2-NEXT: ext $3, $1, 16, 1399; MIPS32R2-NEXT: jr $ra400; MIPS32R2-NEXT: addiu $2, $zero, 0401;402; MIPS32R6-LABEL: bittest_16_i64:403; MIPS32R6: # %bb.0:404; MIPS32R6-NEXT: not $1, $5405; MIPS32R6-NEXT: ext $3, $1, 16, 1406; MIPS32R6-NEXT: jr $ra407; MIPS32R6-NEXT: addiu $2, $zero, 0408;409; MIPS64-LABEL: bittest_16_i64:410; MIPS64: # %bb.0:411; MIPS64-NEXT: daddiu $1, $zero, -1412; MIPS64-NEXT: xor $1, $4, $1413; MIPS64-NEXT: dsrl $1, $1, 16414; MIPS64-NEXT: jr $ra415; MIPS64-NEXT: andi $2, $1, 1416;417; MIPS64R2-LABEL: bittest_16_i64:418; MIPS64R2: # %bb.0:419; MIPS64R2-NEXT: daddiu $1, $zero, -1420; MIPS64R2-NEXT: xor $1, $4, $1421; MIPS64R2-NEXT: jr $ra422; MIPS64R2-NEXT: dext $2, $1, 16, 1423;424; MIPS64R6-LABEL: bittest_16_i64:425; MIPS64R6: # %bb.0:426; MIPS64R6-NEXT: daddiu $1, $zero, -1427; MIPS64R6-NEXT: xor $1, $4, $1428; MIPS64R6-NEXT: jr $ra429; MIPS64R6-NEXT: dext $2, $1, 16, 1430;431; MM32R3-LABEL: bittest_16_i64:432; MM32R3: # %bb.0:433; MM32R3-NEXT: not16 $2, $5434; MM32R3-NEXT: ext $3, $2, 16, 1435; MM32R3-NEXT: li16 $2, 0436; MM32R3-NEXT: jrc $ra437;438; MM32R6-LABEL: bittest_16_i64:439; MM32R6: # %bb.0:440; MM32R6-NEXT: not16 $2, $5441; MM32R6-NEXT: ext $3, $2, 16, 1442; MM32R6-NEXT: li16 $2, 0443; MM32R6-NEXT: jrc $ra444 %shr = lshr i64 %a, 16445 %not = xor i64 %shr, -1446 %and = and i64 %not, 1447 ret i64 %and448}449 450define i64 @bittest_31_i64(i64 %a) nounwind {451; MIPS-LABEL: bittest_31_i64:452; MIPS: # %bb.0:453; MIPS-NEXT: not $1, $5454; MIPS-NEXT: srl $3, $1, 31455; MIPS-NEXT: jr $ra456; MIPS-NEXT: addiu $2, $zero, 0457;458; MIPS32R2-LABEL: bittest_31_i64:459; MIPS32R2: # %bb.0:460; MIPS32R2-NEXT: not $1, $5461; MIPS32R2-NEXT: srl $3, $1, 31462; MIPS32R2-NEXT: jr $ra463; MIPS32R2-NEXT: addiu $2, $zero, 0464;465; MIPS32R6-LABEL: bittest_31_i64:466; MIPS32R6: # %bb.0:467; MIPS32R6-NEXT: not $1, $5468; MIPS32R6-NEXT: srl $3, $1, 31469; MIPS32R6-NEXT: jr $ra470; MIPS32R6-NEXT: addiu $2, $zero, 0471;472; MIPS64-LABEL: bittest_31_i64:473; MIPS64: # %bb.0:474; MIPS64-NEXT: daddiu $1, $zero, -1475; MIPS64-NEXT: xor $1, $4, $1476; MIPS64-NEXT: dsrl $1, $1, 31477; MIPS64-NEXT: jr $ra478; MIPS64-NEXT: andi $2, $1, 1479;480; MIPS64R2-LABEL: bittest_31_i64:481; MIPS64R2: # %bb.0:482; MIPS64R2-NEXT: daddiu $1, $zero, -1483; MIPS64R2-NEXT: xor $1, $4, $1484; MIPS64R2-NEXT: jr $ra485; MIPS64R2-NEXT: dext $2, $1, 31, 1486;487; MIPS64R6-LABEL: bittest_31_i64:488; MIPS64R6: # %bb.0:489; MIPS64R6-NEXT: daddiu $1, $zero, -1490; MIPS64R6-NEXT: xor $1, $4, $1491; MIPS64R6-NEXT: jr $ra492; MIPS64R6-NEXT: dext $2, $1, 31, 1493;494; MM32R3-LABEL: bittest_31_i64:495; MM32R3: # %bb.0:496; MM32R3-NEXT: not16 $2, $5497; MM32R3-NEXT: srl $3, $2, 31498; MM32R3-NEXT: li16 $2, 0499; MM32R3-NEXT: jrc $ra500;501; MM32R6-LABEL: bittest_31_i64:502; MM32R6: # %bb.0:503; MM32R6-NEXT: not16 $2, $5504; MM32R6-NEXT: srl $3, $2, 31505; MM32R6-NEXT: li16 $2, 0506; MM32R6-NEXT: jrc $ra507 %shr = lshr i64 %a, 31508 %not = xor i64 %shr, -1509 %and = and i64 %not, 1510 ret i64 %and511}512 513define i64 @bittest_32_i64(i64 %a) nounwind {514; MIPS-LABEL: bittest_32_i64:515; MIPS: # %bb.0:516; MIPS-NEXT: not $1, $4517; MIPS-NEXT: andi $3, $1, 1518; MIPS-NEXT: jr $ra519; MIPS-NEXT: addiu $2, $zero, 0520;521; MIPS32R2-LABEL: bittest_32_i64:522; MIPS32R2: # %bb.0:523; MIPS32R2-NEXT: not $1, $4524; MIPS32R2-NEXT: andi $3, $1, 1525; MIPS32R2-NEXT: jr $ra526; MIPS32R2-NEXT: addiu $2, $zero, 0527;528; MIPS32R6-LABEL: bittest_32_i64:529; MIPS32R6: # %bb.0:530; MIPS32R6-NEXT: not $1, $4531; MIPS32R6-NEXT: andi $3, $1, 1532; MIPS32R6-NEXT: jr $ra533; MIPS32R6-NEXT: addiu $2, $zero, 0534;535; MIPS64-LABEL: bittest_32_i64:536; MIPS64: # %bb.0:537; MIPS64-NEXT: daddiu $1, $zero, -1538; MIPS64-NEXT: xor $1, $4, $1539; MIPS64-NEXT: dsrl $1, $1, 32540; MIPS64-NEXT: jr $ra541; MIPS64-NEXT: andi $2, $1, 1542;543; MIPS64R2-LABEL: bittest_32_i64:544; MIPS64R2: # %bb.0:545; MIPS64R2-NEXT: daddiu $1, $zero, -1546; MIPS64R2-NEXT: xor $1, $4, $1547; MIPS64R2-NEXT: jr $ra548; MIPS64R2-NEXT: dextu $2, $1, 32, 1549;550; MIPS64R6-LABEL: bittest_32_i64:551; MIPS64R6: # %bb.0:552; MIPS64R6-NEXT: daddiu $1, $zero, -1553; MIPS64R6-NEXT: xor $1, $4, $1554; MIPS64R6-NEXT: jr $ra555; MIPS64R6-NEXT: dextu $2, $1, 32, 1556;557; MM32R3-LABEL: bittest_32_i64:558; MM32R3: # %bb.0:559; MM32R3-NEXT: not16 $2, $4560; MM32R3-NEXT: andi16 $3, $2, 1561; MM32R3-NEXT: li16 $2, 0562; MM32R3-NEXT: jrc $ra563;564; MM32R6-LABEL: bittest_32_i64:565; MM32R6: # %bb.0:566; MM32R6-NEXT: not16 $2, $4567; MM32R6-NEXT: andi16 $3, $2, 1568; MM32R6-NEXT: li16 $2, 0569; MM32R6-NEXT: jrc $ra570 %shr = lshr i64 %a, 32571 %not = xor i64 %shr, -1572 %and = and i64 %not, 1573 ret i64 %and574}575 576define i64 @bittest_63_i64(i64 %a) nounwind {577; MIPS-LABEL: bittest_63_i64:578; MIPS: # %bb.0:579; MIPS-NEXT: not $1, $4580; MIPS-NEXT: srl $3, $1, 31581; MIPS-NEXT: jr $ra582; MIPS-NEXT: addiu $2, $zero, 0583;584; MIPS32R2-LABEL: bittest_63_i64:585; MIPS32R2: # %bb.0:586; MIPS32R2-NEXT: not $1, $4587; MIPS32R2-NEXT: srl $3, $1, 31588; MIPS32R2-NEXT: jr $ra589; MIPS32R2-NEXT: addiu $2, $zero, 0590;591; MIPS32R6-LABEL: bittest_63_i64:592; MIPS32R6: # %bb.0:593; MIPS32R6-NEXT: not $1, $4594; MIPS32R6-NEXT: srl $3, $1, 31595; MIPS32R6-NEXT: jr $ra596; MIPS32R6-NEXT: addiu $2, $zero, 0597;598; MIPS64-LABEL: bittest_63_i64:599; MIPS64: # %bb.0:600; MIPS64-NEXT: daddiu $1, $zero, -1601; MIPS64-NEXT: xor $1, $4, $1602; MIPS64-NEXT: jr $ra603; MIPS64-NEXT: dsrl $2, $1, 63604;605; MIPS64R2-LABEL: bittest_63_i64:606; MIPS64R2: # %bb.0:607; MIPS64R2-NEXT: daddiu $1, $zero, -1608; MIPS64R2-NEXT: xor $1, $4, $1609; MIPS64R2-NEXT: jr $ra610; MIPS64R2-NEXT: dsrl $2, $1, 63611;612; MIPS64R6-LABEL: bittest_63_i64:613; MIPS64R6: # %bb.0:614; MIPS64R6-NEXT: daddiu $1, $zero, -1615; MIPS64R6-NEXT: xor $1, $4, $1616; MIPS64R6-NEXT: jr $ra617; MIPS64R6-NEXT: dsrl $2, $1, 63618;619; MM32R3-LABEL: bittest_63_i64:620; MM32R3: # %bb.0:621; MM32R3-NEXT: not16 $2, $4622; MM32R3-NEXT: srl $3, $2, 31623; MM32R3-NEXT: li16 $2, 0624; MM32R3-NEXT: jrc $ra625;626; MM32R6-LABEL: bittest_63_i64:627; MM32R6: # %bb.0:628; MM32R6-NEXT: not16 $2, $4629; MM32R6-NEXT: srl $3, $2, 31630; MM32R6-NEXT: li16 $2, 0631; MM32R6-NEXT: jrc $ra632 %shr = lshr i64 %a, 63633 %not = xor i64 %shr, -1634 %and = and i64 %not, 1635 ret i64 %and636}637