881 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -global-isel -mtriple=mipsel-linux-gnu -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS323 4; --------------------------------------------------------------------5; unordered6; --------------------------------------------------------------------7 8define i8 @atomic_load_unordered_i8(ptr %ptr) {9; MIPS32-LABEL: atomic_load_unordered_i8:10; MIPS32: # %bb.0:11; MIPS32-NEXT: lbu $2, 0($4)12; MIPS32-NEXT: jr $ra13; MIPS32-NEXT: nop14 %load = load atomic i8, ptr %ptr unordered, align 115 ret i8 %load16}17 18define i32 @atomic_load_unordered_i8_sext_i32(ptr %ptr) {19; MIPS32-LABEL: atomic_load_unordered_i8_sext_i32:20; MIPS32: # %bb.0:21; MIPS32-NEXT: lbu $1, 0($4)22; MIPS32-NEXT: sll $1, $1, 2423; MIPS32-NEXT: jr $ra24; MIPS32-NEXT: sra $2, $1, 2425 %load = load atomic i8, ptr %ptr unordered, align 126 %sext = sext i8 %load to i3227 ret i32 %sext28}29 30define i16 @atomic_load_unordered_i8_sext_i16(ptr %ptr) {31; MIPS32-LABEL: atomic_load_unordered_i8_sext_i16:32; MIPS32: # %bb.0:33; MIPS32-NEXT: lbu $1, 0($4)34; MIPS32-NEXT: sll $1, $1, 2435; MIPS32-NEXT: jr $ra36; MIPS32-NEXT: sra $2, $1, 2437 %load = load atomic i8, ptr %ptr unordered, align 138 %sext = sext i8 %load to i1639 ret i16 %sext40}41 42define i64 @atomic_load_unordered_i8_sext_i64(ptr %ptr) {43; MIPS32-LABEL: atomic_load_unordered_i8_sext_i64:44; MIPS32: # %bb.0:45; MIPS32-NEXT: lbu $1, 0($4)46; MIPS32-NEXT: sll $1, $1, 2447; MIPS32-NEXT: sra $2, $1, 2448; MIPS32-NEXT: jr $ra49; MIPS32-NEXT: sra $3, $1, 3150 %load = load atomic i8, ptr %ptr unordered, align 151 %sext = sext i8 %load to i6452 ret i64 %sext53}54 55define i32 @atomic_load_unordered_i8_zext_i32(ptr %ptr) {56; MIPS32-LABEL: atomic_load_unordered_i8_zext_i32:57; MIPS32: # %bb.0:58; MIPS32-NEXT: lbu $1, 0($4)59; MIPS32-NEXT: jr $ra60; MIPS32-NEXT: andi $2, $1, 25561 %load = load atomic i8, ptr %ptr unordered, align 162 %zext = zext i8 %load to i3263 ret i32 %zext64}65 66define i16 @atomic_load_unordered_i8_zext_i16(ptr %ptr) {67; MIPS32-LABEL: atomic_load_unordered_i8_zext_i16:68; MIPS32: # %bb.0:69; MIPS32-NEXT: lbu $1, 0($4)70; MIPS32-NEXT: jr $ra71; MIPS32-NEXT: andi $2, $1, 25572 %load = load atomic i8, ptr %ptr unordered, align 173 %zext = zext i8 %load to i1674 ret i16 %zext75}76 77define i64 @atomic_load_unordered_i8_zext_i64(ptr %ptr) {78; MIPS32-LABEL: atomic_load_unordered_i8_zext_i64:79; MIPS32: # %bb.0:80; MIPS32-NEXT: lbu $1, 0($4)81; MIPS32-NEXT: andi $2, $1, 25582; MIPS32-NEXT: jr $ra83; MIPS32-NEXT: andi $3, $1, 084 %load = load atomic i8, ptr %ptr unordered, align 185 %zext = zext i8 %load to i6486 ret i64 %zext87}88 89define i16 @atomic_load_unordered_i16(ptr %ptr) {90; MIPS32-LABEL: atomic_load_unordered_i16:91; MIPS32: # %bb.0:92; MIPS32-NEXT: lhu $2, 0($4)93; MIPS32-NEXT: jr $ra94; MIPS32-NEXT: nop95 %load = load atomic i16, ptr %ptr unordered, align 296 ret i16 %load97}98 99define i32 @atomic_load_unordered_i16_sext_i32(ptr %ptr) {100; MIPS32-LABEL: atomic_load_unordered_i16_sext_i32:101; MIPS32: # %bb.0:102; MIPS32-NEXT: lhu $1, 0($4)103; MIPS32-NEXT: sll $1, $1, 16104; MIPS32-NEXT: jr $ra105; MIPS32-NEXT: sra $2, $1, 16106 %load = load atomic i16, ptr %ptr unordered, align 2107 %sext = sext i16 %load to i32108 ret i32 %sext109}110 111define i64 @atomic_load_unordered_i16_sext_i64(ptr %ptr) {112; MIPS32-LABEL: atomic_load_unordered_i16_sext_i64:113; MIPS32: # %bb.0:114; MIPS32-NEXT: lhu $1, 0($4)115; MIPS32-NEXT: sll $1, $1, 16116; MIPS32-NEXT: sra $2, $1, 16117; MIPS32-NEXT: jr $ra118; MIPS32-NEXT: sra $3, $1, 31119 %load = load atomic i16, ptr %ptr unordered, align 2120 %sext = sext i16 %load to i64121 ret i64 %sext122}123 124define i32 @atomic_load_unordered_i16_zext_i32(ptr %ptr) {125; MIPS32-LABEL: atomic_load_unordered_i16_zext_i32:126; MIPS32: # %bb.0:127; MIPS32-NEXT: lhu $1, 0($4)128; MIPS32-NEXT: jr $ra129; MIPS32-NEXT: andi $2, $1, 65535130 %load = load atomic i16, ptr %ptr unordered, align 2131 %zext = zext i16 %load to i32132 ret i32 %zext133}134 135define i64 @atomic_load_unordered_i16_zext_i64(ptr %ptr) {136; MIPS32-LABEL: atomic_load_unordered_i16_zext_i64:137; MIPS32: # %bb.0:138; MIPS32-NEXT: lhu $1, 0($4)139; MIPS32-NEXT: andi $2, $1, 65535140; MIPS32-NEXT: jr $ra141; MIPS32-NEXT: andi $3, $1, 0142 %load = load atomic i16, ptr %ptr unordered, align 2143 %zext = zext i16 %load to i64144 ret i64 %zext145}146 147define i32 @atomic_load_unordered_i32(ptr %ptr) {148; MIPS32-LABEL: atomic_load_unordered_i32:149; MIPS32: # %bb.0:150; MIPS32-NEXT: lw $2, 0($4)151; MIPS32-NEXT: jr $ra152; MIPS32-NEXT: nop153 %load = load atomic i32, ptr %ptr unordered, align 4154 ret i32 %load155}156 157define i64 @atomic_load_unordered_i64(ptr %ptr) {158; MIPS32-LABEL: atomic_load_unordered_i64:159; MIPS32: # %bb.0:160; MIPS32-NEXT: addiu $sp, $sp, -24161; MIPS32-NEXT: .cfi_def_cfa_offset 24162; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill163; MIPS32-NEXT: .cfi_offset 31, -4164; MIPS32-NEXT: jal __atomic_load_8165; MIPS32-NEXT: ori $5, $zero, 0166; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload167; MIPS32-NEXT: jr $ra168; MIPS32-NEXT: addiu $sp, $sp, 24169 %load = load atomic i64, ptr %ptr unordered, align 8170 ret i64 %load171}172 173define float @atomic_load_unordered_f32(ptr %ptr) {174; MIPS32-LABEL: atomic_load_unordered_f32:175; MIPS32: # %bb.0:176; MIPS32-NEXT: lwc1 $f0, 64($4)177; MIPS32-NEXT: jr $ra178; MIPS32-NEXT: nop179 %gep = getelementptr inbounds float, ptr %ptr, i32 16180 %load = load atomic float, ptr %gep unordered, align 4181 ret float %load182}183 184define double @atomic_load_unordered_f64(ptr %ptr) {185; MIPS32-LABEL: atomic_load_unordered_f64:186; MIPS32: # %bb.0:187; MIPS32-NEXT: addiu $sp, $sp, -24188; MIPS32-NEXT: .cfi_def_cfa_offset 24189; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill190; MIPS32-NEXT: .cfi_offset 31, -4191; MIPS32-NEXT: ori $5, $zero, 0192; MIPS32-NEXT: ori $1, $zero, 128193; MIPS32-NEXT: jal __atomic_load_8194; MIPS32-NEXT: addu $4, $4, $1195; MIPS32-NEXT: mtc1 $2, $f0196; MIPS32-NEXT: mtc1 $3, $f1197; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload198; MIPS32-NEXT: jr $ra199; MIPS32-NEXT: addiu $sp, $sp, 24200 %gep = getelementptr inbounds double, ptr %ptr, i32 16201 %load = load atomic double, ptr %gep unordered, align 8202 ret double %load203}204 205define ptr @atomic_load_unordered_p0i8(ptr %ptr) {206; MIPS32-LABEL: atomic_load_unordered_p0i8:207; MIPS32: # %bb.0:208; MIPS32-NEXT: lw $2, 64($4)209; MIPS32-NEXT: jr $ra210; MIPS32-NEXT: nop211 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16212 %load = load atomic ptr, ptr %gep unordered, align 4213 ret ptr %load214}215 216; --------------------------------------------------------------------217; monotonic218; --------------------------------------------------------------------219 220define i8 @atomic_load_monotonic_i8(ptr %ptr) {221; MIPS32-LABEL: atomic_load_monotonic_i8:222; MIPS32: # %bb.0:223; MIPS32-NEXT: lbu $2, 0($4)224; MIPS32-NEXT: jr $ra225; MIPS32-NEXT: nop226 %load = load atomic i8, ptr %ptr monotonic, align 1227 ret i8 %load228}229 230define i32 @atomic_load_monotonic_i8_sext_i32(ptr %ptr) {231; MIPS32-LABEL: atomic_load_monotonic_i8_sext_i32:232; MIPS32: # %bb.0:233; MIPS32-NEXT: lbu $1, 0($4)234; MIPS32-NEXT: sll $1, $1, 24235; MIPS32-NEXT: jr $ra236; MIPS32-NEXT: sra $2, $1, 24237 %load = load atomic i8, ptr %ptr monotonic, align 1238 %sext = sext i8 %load to i32239 ret i32 %sext240}241 242define i16 @atomic_load_monotonic_i8_sext_i16(ptr %ptr) {243; MIPS32-LABEL: atomic_load_monotonic_i8_sext_i16:244; MIPS32: # %bb.0:245; MIPS32-NEXT: lbu $1, 0($4)246; MIPS32-NEXT: sll $1, $1, 24247; MIPS32-NEXT: jr $ra248; MIPS32-NEXT: sra $2, $1, 24249 %load = load atomic i8, ptr %ptr monotonic, align 1250 %sext = sext i8 %load to i16251 ret i16 %sext252}253 254define i64 @atomic_load_monotonic_i8_sext_i64(ptr %ptr) {255; MIPS32-LABEL: atomic_load_monotonic_i8_sext_i64:256; MIPS32: # %bb.0:257; MIPS32-NEXT: lbu $1, 0($4)258; MIPS32-NEXT: sll $1, $1, 24259; MIPS32-NEXT: sra $2, $1, 24260; MIPS32-NEXT: jr $ra261; MIPS32-NEXT: sra $3, $1, 31262 %load = load atomic i8, ptr %ptr monotonic, align 1263 %sext = sext i8 %load to i64264 ret i64 %sext265}266 267define i32 @atomic_load_monotonic_i8_zext_i32(ptr %ptr) {268; MIPS32-LABEL: atomic_load_monotonic_i8_zext_i32:269; MIPS32: # %bb.0:270; MIPS32-NEXT: lbu $1, 0($4)271; MIPS32-NEXT: jr $ra272; MIPS32-NEXT: andi $2, $1, 255273 %load = load atomic i8, ptr %ptr monotonic, align 1274 %zext = zext i8 %load to i32275 ret i32 %zext276}277 278define i16 @atomic_load_monotonic_i8_zext_i16(ptr %ptr) {279; MIPS32-LABEL: atomic_load_monotonic_i8_zext_i16:280; MIPS32: # %bb.0:281; MIPS32-NEXT: lbu $1, 0($4)282; MIPS32-NEXT: jr $ra283; MIPS32-NEXT: andi $2, $1, 255284 %load = load atomic i8, ptr %ptr monotonic, align 1285 %zext = zext i8 %load to i16286 ret i16 %zext287}288 289define i64 @atomic_load_monotonic_i8_zext_i64(ptr %ptr) {290; MIPS32-LABEL: atomic_load_monotonic_i8_zext_i64:291; MIPS32: # %bb.0:292; MIPS32-NEXT: lbu $1, 0($4)293; MIPS32-NEXT: andi $2, $1, 255294; MIPS32-NEXT: jr $ra295; MIPS32-NEXT: andi $3, $1, 0296 %load = load atomic i8, ptr %ptr monotonic, align 1297 %zext = zext i8 %load to i64298 ret i64 %zext299}300 301define i16 @atomic_load_monotonic_i16(ptr %ptr) {302; MIPS32-LABEL: atomic_load_monotonic_i16:303; MIPS32: # %bb.0:304; MIPS32-NEXT: lhu $2, 0($4)305; MIPS32-NEXT: jr $ra306; MIPS32-NEXT: nop307 %load = load atomic i16, ptr %ptr monotonic, align 2308 ret i16 %load309}310 311define i32 @atomic_load_monotonic_i16_sext_i32(ptr %ptr) {312; MIPS32-LABEL: atomic_load_monotonic_i16_sext_i32:313; MIPS32: # %bb.0:314; MIPS32-NEXT: lhu $1, 0($4)315; MIPS32-NEXT: sll $1, $1, 16316; MIPS32-NEXT: jr $ra317; MIPS32-NEXT: sra $2, $1, 16318 %load = load atomic i16, ptr %ptr monotonic, align 2319 %sext = sext i16 %load to i32320 ret i32 %sext321}322 323define i64 @atomic_load_monotonic_i16_sext_i64(ptr %ptr) {324; MIPS32-LABEL: atomic_load_monotonic_i16_sext_i64:325; MIPS32: # %bb.0:326; MIPS32-NEXT: lhu $1, 0($4)327; MIPS32-NEXT: sll $1, $1, 16328; MIPS32-NEXT: sra $2, $1, 16329; MIPS32-NEXT: jr $ra330; MIPS32-NEXT: sra $3, $1, 31331 %load = load atomic i16, ptr %ptr monotonic, align 2332 %sext = sext i16 %load to i64333 ret i64 %sext334}335 336define i32 @atomic_load_monotonic_i16_zext_i32(ptr %ptr) {337; MIPS32-LABEL: atomic_load_monotonic_i16_zext_i32:338; MIPS32: # %bb.0:339; MIPS32-NEXT: lhu $1, 0($4)340; MIPS32-NEXT: jr $ra341; MIPS32-NEXT: andi $2, $1, 65535342 %load = load atomic i16, ptr %ptr monotonic, align 2343 %zext = zext i16 %load to i32344 ret i32 %zext345}346 347define i64 @atomic_load_monotonic_i16_zext_i64(ptr %ptr) {348; MIPS32-LABEL: atomic_load_monotonic_i16_zext_i64:349; MIPS32: # %bb.0:350; MIPS32-NEXT: lhu $1, 0($4)351; MIPS32-NEXT: andi $2, $1, 65535352; MIPS32-NEXT: jr $ra353; MIPS32-NEXT: andi $3, $1, 0354 %load = load atomic i16, ptr %ptr monotonic, align 2355 %zext = zext i16 %load to i64356 ret i64 %zext357}358 359define i32 @atomic_load_monotonic_i32(ptr %ptr) {360; MIPS32-LABEL: atomic_load_monotonic_i32:361; MIPS32: # %bb.0:362; MIPS32-NEXT: lw $2, 0($4)363; MIPS32-NEXT: jr $ra364; MIPS32-NEXT: nop365 %load = load atomic i32, ptr %ptr monotonic, align 4366 ret i32 %load367}368 369define i64 @atomic_load_monotonic_i64(ptr %ptr) {370; MIPS32-LABEL: atomic_load_monotonic_i64:371; MIPS32: # %bb.0:372; MIPS32-NEXT: addiu $sp, $sp, -24373; MIPS32-NEXT: .cfi_def_cfa_offset 24374; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill375; MIPS32-NEXT: .cfi_offset 31, -4376; MIPS32-NEXT: jal __atomic_load_8377; MIPS32-NEXT: ori $5, $zero, 0378; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload379; MIPS32-NEXT: jr $ra380; MIPS32-NEXT: addiu $sp, $sp, 24381 %load = load atomic i64, ptr %ptr monotonic, align 8382 ret i64 %load383}384 385define float @atomic_load_monotonic_f32(ptr %ptr) {386; MIPS32-LABEL: atomic_load_monotonic_f32:387; MIPS32: # %bb.0:388; MIPS32-NEXT: lwc1 $f0, 64($4)389; MIPS32-NEXT: jr $ra390; MIPS32-NEXT: nop391 %gep = getelementptr inbounds float, ptr %ptr, i32 16392 %load = load atomic float, ptr %gep monotonic, align 4393 ret float %load394}395 396define double @atomic_load_monotonic_f64(ptr %ptr) {397; MIPS32-LABEL: atomic_load_monotonic_f64:398; MIPS32: # %bb.0:399; MIPS32-NEXT: addiu $sp, $sp, -24400; MIPS32-NEXT: .cfi_def_cfa_offset 24401; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill402; MIPS32-NEXT: .cfi_offset 31, -4403; MIPS32-NEXT: ori $5, $zero, 0404; MIPS32-NEXT: ori $1, $zero, 128405; MIPS32-NEXT: jal __atomic_load_8406; MIPS32-NEXT: addu $4, $4, $1407; MIPS32-NEXT: mtc1 $2, $f0408; MIPS32-NEXT: mtc1 $3, $f1409; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload410; MIPS32-NEXT: jr $ra411; MIPS32-NEXT: addiu $sp, $sp, 24412 %gep = getelementptr inbounds double, ptr %ptr, i32 16413 %load = load atomic double, ptr %gep monotonic, align 8414 ret double %load415}416 417define ptr @atomic_load_monotonic_p0i8(ptr %ptr) {418; MIPS32-LABEL: atomic_load_monotonic_p0i8:419; MIPS32: # %bb.0:420; MIPS32-NEXT: lw $2, 64($4)421; MIPS32-NEXT: jr $ra422; MIPS32-NEXT: nop423 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16424 %load = load atomic ptr, ptr %gep monotonic, align 4425 ret ptr %load426}427 428; --------------------------------------------------------------------429; acquire430; --------------------------------------------------------------------431 432define i8 @atomic_load_acquire_i8(ptr %ptr) {433; MIPS32-LABEL: atomic_load_acquire_i8:434; MIPS32: # %bb.0:435; MIPS32-NEXT: lbu $2, 0($4)436; MIPS32-NEXT: sync437; MIPS32-NEXT: jr $ra438; MIPS32-NEXT: nop439 %load = load atomic i8, ptr %ptr acquire, align 1440 ret i8 %load441}442 443define i32 @atomic_load_acquire_i8_sext_i32(ptr %ptr) {444; MIPS32-LABEL: atomic_load_acquire_i8_sext_i32:445; MIPS32: # %bb.0:446; MIPS32-NEXT: lbu $1, 0($4)447; MIPS32-NEXT: sync448; MIPS32-NEXT: sll $1, $1, 24449; MIPS32-NEXT: jr $ra450; MIPS32-NEXT: sra $2, $1, 24451 %load = load atomic i8, ptr %ptr acquire, align 1452 %sext = sext i8 %load to i32453 ret i32 %sext454}455 456define i16 @atomic_load_acquire_i8_sext_i16(ptr %ptr) {457; MIPS32-LABEL: atomic_load_acquire_i8_sext_i16:458; MIPS32: # %bb.0:459; MIPS32-NEXT: lbu $1, 0($4)460; MIPS32-NEXT: sync461; MIPS32-NEXT: sll $1, $1, 24462; MIPS32-NEXT: jr $ra463; MIPS32-NEXT: sra $2, $1, 24464 %load = load atomic i8, ptr %ptr acquire, align 1465 %sext = sext i8 %load to i16466 ret i16 %sext467}468 469define i64 @atomic_load_acquire_i8_sext_i64(ptr %ptr) {470; MIPS32-LABEL: atomic_load_acquire_i8_sext_i64:471; MIPS32: # %bb.0:472; MIPS32-NEXT: lbu $1, 0($4)473; MIPS32-NEXT: sync474; MIPS32-NEXT: sll $1, $1, 24475; MIPS32-NEXT: sra $2, $1, 24476; MIPS32-NEXT: jr $ra477; MIPS32-NEXT: sra $3, $1, 31478 %load = load atomic i8, ptr %ptr acquire, align 1479 %sext = sext i8 %load to i64480 ret i64 %sext481}482 483define i32 @atomic_load_acquire_i8_zext_i32(ptr %ptr) {484; MIPS32-LABEL: atomic_load_acquire_i8_zext_i32:485; MIPS32: # %bb.0:486; MIPS32-NEXT: lbu $1, 0($4)487; MIPS32-NEXT: sync488; MIPS32-NEXT: jr $ra489; MIPS32-NEXT: andi $2, $1, 255490 %load = load atomic i8, ptr %ptr acquire, align 1491 %zext = zext i8 %load to i32492 ret i32 %zext493}494 495define i16 @atomic_load_acquire_i8_zext_i16(ptr %ptr) {496; MIPS32-LABEL: atomic_load_acquire_i8_zext_i16:497; MIPS32: # %bb.0:498; MIPS32-NEXT: lbu $1, 0($4)499; MIPS32-NEXT: sync500; MIPS32-NEXT: jr $ra501; MIPS32-NEXT: andi $2, $1, 255502 %load = load atomic i8, ptr %ptr acquire, align 1503 %zext = zext i8 %load to i16504 ret i16 %zext505}506 507define i64 @atomic_load_acquire_i8_zext_i64(ptr %ptr) {508; MIPS32-LABEL: atomic_load_acquire_i8_zext_i64:509; MIPS32: # %bb.0:510; MIPS32-NEXT: lbu $1, 0($4)511; MIPS32-NEXT: sync512; MIPS32-NEXT: andi $2, $1, 255513; MIPS32-NEXT: jr $ra514; MIPS32-NEXT: andi $3, $1, 0515 %load = load atomic i8, ptr %ptr acquire, align 1516 %zext = zext i8 %load to i64517 ret i64 %zext518}519 520define i16 @atomic_load_acquire_i16(ptr %ptr) {521; MIPS32-LABEL: atomic_load_acquire_i16:522; MIPS32: # %bb.0:523; MIPS32-NEXT: lhu $2, 0($4)524; MIPS32-NEXT: sync525; MIPS32-NEXT: jr $ra526; MIPS32-NEXT: nop527 %load = load atomic i16, ptr %ptr acquire, align 2528 ret i16 %load529}530 531define i32 @atomic_load_acquire_i16_sext_i32(ptr %ptr) {532; MIPS32-LABEL: atomic_load_acquire_i16_sext_i32:533; MIPS32: # %bb.0:534; MIPS32-NEXT: lhu $1, 0($4)535; MIPS32-NEXT: sync536; MIPS32-NEXT: sll $1, $1, 16537; MIPS32-NEXT: jr $ra538; MIPS32-NEXT: sra $2, $1, 16539 %load = load atomic i16, ptr %ptr acquire, align 2540 %sext = sext i16 %load to i32541 ret i32 %sext542}543 544define i64 @atomic_load_acquire_i16_sext_i64(ptr %ptr) {545; MIPS32-LABEL: atomic_load_acquire_i16_sext_i64:546; MIPS32: # %bb.0:547; MIPS32-NEXT: lhu $1, 0($4)548; MIPS32-NEXT: sync549; MIPS32-NEXT: sll $1, $1, 16550; MIPS32-NEXT: sra $2, $1, 16551; MIPS32-NEXT: jr $ra552; MIPS32-NEXT: sra $3, $1, 31553 %load = load atomic i16, ptr %ptr acquire, align 2554 %sext = sext i16 %load to i64555 ret i64 %sext556}557 558define i32 @atomic_load_acquire_i16_zext_i32(ptr %ptr) {559; MIPS32-LABEL: atomic_load_acquire_i16_zext_i32:560; MIPS32: # %bb.0:561; MIPS32-NEXT: lhu $1, 0($4)562; MIPS32-NEXT: sync563; MIPS32-NEXT: jr $ra564; MIPS32-NEXT: andi $2, $1, 65535565 %load = load atomic i16, ptr %ptr acquire, align 2566 %zext = zext i16 %load to i32567 ret i32 %zext568}569 570define i64 @atomic_load_acquire_i16_zext_i64(ptr %ptr) {571; MIPS32-LABEL: atomic_load_acquire_i16_zext_i64:572; MIPS32: # %bb.0:573; MIPS32-NEXT: lhu $1, 0($4)574; MIPS32-NEXT: sync575; MIPS32-NEXT: andi $2, $1, 65535576; MIPS32-NEXT: jr $ra577; MIPS32-NEXT: andi $3, $1, 0578 %load = load atomic i16, ptr %ptr acquire, align 2579 %zext = zext i16 %load to i64580 ret i64 %zext581}582 583define i32 @atomic_load_acquire_i32(ptr %ptr) {584; MIPS32-LABEL: atomic_load_acquire_i32:585; MIPS32: # %bb.0:586; MIPS32-NEXT: lw $2, 0($4)587; MIPS32-NEXT: sync588; MIPS32-NEXT: jr $ra589; MIPS32-NEXT: nop590 %load = load atomic i32, ptr %ptr acquire, align 4591 ret i32 %load592}593 594define i64 @atomic_load_acquire_i64(ptr %ptr) {595; MIPS32-LABEL: atomic_load_acquire_i64:596; MIPS32: # %bb.0:597; MIPS32-NEXT: addiu $sp, $sp, -24598; MIPS32-NEXT: .cfi_def_cfa_offset 24599; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill600; MIPS32-NEXT: .cfi_offset 31, -4601; MIPS32-NEXT: jal __atomic_load_8602; MIPS32-NEXT: ori $5, $zero, 2603; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload604; MIPS32-NEXT: jr $ra605; MIPS32-NEXT: addiu $sp, $sp, 24606 %load = load atomic i64, ptr %ptr acquire, align 8607 ret i64 %load608}609 610define float @atomic_load_acquire_f32(ptr %ptr) {611; MIPS32-LABEL: atomic_load_acquire_f32:612; MIPS32: # %bb.0:613; MIPS32-NEXT: lwc1 $f0, 64($4)614; MIPS32-NEXT: sync615; MIPS32-NEXT: jr $ra616; MIPS32-NEXT: nop617 %gep = getelementptr inbounds float, ptr %ptr, i32 16618 %load = load atomic float, ptr %gep acquire, align 4619 ret float %load620}621 622define double @atomic_load_acquire_f64(ptr %ptr) {623; MIPS32-LABEL: atomic_load_acquire_f64:624; MIPS32: # %bb.0:625; MIPS32-NEXT: addiu $sp, $sp, -24626; MIPS32-NEXT: .cfi_def_cfa_offset 24627; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill628; MIPS32-NEXT: .cfi_offset 31, -4629; MIPS32-NEXT: ori $5, $zero, 2630; MIPS32-NEXT: ori $1, $zero, 128631; MIPS32-NEXT: jal __atomic_load_8632; MIPS32-NEXT: addu $4, $4, $1633; MIPS32-NEXT: mtc1 $2, $f0634; MIPS32-NEXT: mtc1 $3, $f1635; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload636; MIPS32-NEXT: jr $ra637; MIPS32-NEXT: addiu $sp, $sp, 24638 %gep = getelementptr inbounds double, ptr %ptr, i32 16639 %load = load atomic double, ptr %gep acquire, align 8640 ret double %load641}642 643define ptr @atomic_load_acquire_p0i8(ptr %ptr) {644; MIPS32-LABEL: atomic_load_acquire_p0i8:645; MIPS32: # %bb.0:646; MIPS32-NEXT: lw $2, 64($4)647; MIPS32-NEXT: sync648; MIPS32-NEXT: jr $ra649; MIPS32-NEXT: nop650 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16651 %load = load atomic ptr, ptr %gep acquire, align 4652 ret ptr %load653}654 655; --------------------------------------------------------------------656; seq_cst657; --------------------------------------------------------------------658 659define i8 @atomic_load_seq_cst_i8(ptr %ptr) {660; MIPS32-LABEL: atomic_load_seq_cst_i8:661; MIPS32: # %bb.0:662; MIPS32-NEXT: lbu $2, 0($4)663; MIPS32-NEXT: sync664; MIPS32-NEXT: jr $ra665; MIPS32-NEXT: nop666 %load = load atomic i8, ptr %ptr seq_cst, align 1667 ret i8 %load668}669 670define i32 @atomic_load_seq_cst_i8_sext_i32(ptr %ptr) {671; MIPS32-LABEL: atomic_load_seq_cst_i8_sext_i32:672; MIPS32: # %bb.0:673; MIPS32-NEXT: lbu $1, 0($4)674; MIPS32-NEXT: sync675; MIPS32-NEXT: sll $1, $1, 24676; MIPS32-NEXT: jr $ra677; MIPS32-NEXT: sra $2, $1, 24678 %load = load atomic i8, ptr %ptr seq_cst, align 1679 %sext = sext i8 %load to i32680 ret i32 %sext681}682 683define i16 @atomic_load_seq_cst_i8_sext_i16(ptr %ptr) {684; MIPS32-LABEL: atomic_load_seq_cst_i8_sext_i16:685; MIPS32: # %bb.0:686; MIPS32-NEXT: lbu $1, 0($4)687; MIPS32-NEXT: sync688; MIPS32-NEXT: sll $1, $1, 24689; MIPS32-NEXT: jr $ra690; MIPS32-NEXT: sra $2, $1, 24691 %load = load atomic i8, ptr %ptr seq_cst, align 1692 %sext = sext i8 %load to i16693 ret i16 %sext694}695 696define i64 @atomic_load_seq_cst_i8_sext_i64(ptr %ptr) {697; MIPS32-LABEL: atomic_load_seq_cst_i8_sext_i64:698; MIPS32: # %bb.0:699; MIPS32-NEXT: lbu $1, 0($4)700; MIPS32-NEXT: sync701; MIPS32-NEXT: sll $1, $1, 24702; MIPS32-NEXT: sra $2, $1, 24703; MIPS32-NEXT: jr $ra704; MIPS32-NEXT: sra $3, $1, 31705 %load = load atomic i8, ptr %ptr seq_cst, align 1706 %sext = sext i8 %load to i64707 ret i64 %sext708}709 710define i32 @atomic_load_seq_cst_i8_zext_i32(ptr %ptr) {711; MIPS32-LABEL: atomic_load_seq_cst_i8_zext_i32:712; MIPS32: # %bb.0:713; MIPS32-NEXT: lbu $1, 0($4)714; MIPS32-NEXT: sync715; MIPS32-NEXT: jr $ra716; MIPS32-NEXT: andi $2, $1, 255717 %load = load atomic i8, ptr %ptr seq_cst, align 1718 %zext = zext i8 %load to i32719 ret i32 %zext720}721 722define i16 @atomic_load_seq_cst_i8_zext_i16(ptr %ptr) {723; MIPS32-LABEL: atomic_load_seq_cst_i8_zext_i16:724; MIPS32: # %bb.0:725; MIPS32-NEXT: lbu $1, 0($4)726; MIPS32-NEXT: sync727; MIPS32-NEXT: jr $ra728; MIPS32-NEXT: andi $2, $1, 255729 %load = load atomic i8, ptr %ptr seq_cst, align 1730 %zext = zext i8 %load to i16731 ret i16 %zext732}733 734define i64 @atomic_load_seq_cst_i8_zext_i64(ptr %ptr) {735; MIPS32-LABEL: atomic_load_seq_cst_i8_zext_i64:736; MIPS32: # %bb.0:737; MIPS32-NEXT: lbu $1, 0($4)738; MIPS32-NEXT: sync739; MIPS32-NEXT: andi $2, $1, 255740; MIPS32-NEXT: jr $ra741; MIPS32-NEXT: andi $3, $1, 0742 %load = load atomic i8, ptr %ptr seq_cst, align 1743 %zext = zext i8 %load to i64744 ret i64 %zext745}746 747define i16 @atomic_load_seq_cst_i16(ptr %ptr) {748; MIPS32-LABEL: atomic_load_seq_cst_i16:749; MIPS32: # %bb.0:750; MIPS32-NEXT: lhu $2, 0($4)751; MIPS32-NEXT: sync752; MIPS32-NEXT: jr $ra753; MIPS32-NEXT: nop754 %load = load atomic i16, ptr %ptr seq_cst, align 2755 ret i16 %load756}757 758define i32 @atomic_load_seq_cst_i16_sext_i32(ptr %ptr) {759; MIPS32-LABEL: atomic_load_seq_cst_i16_sext_i32:760; MIPS32: # %bb.0:761; MIPS32-NEXT: lhu $1, 0($4)762; MIPS32-NEXT: sync763; MIPS32-NEXT: sll $1, $1, 16764; MIPS32-NEXT: jr $ra765; MIPS32-NEXT: sra $2, $1, 16766 %load = load atomic i16, ptr %ptr seq_cst, align 2767 %sext = sext i16 %load to i32768 ret i32 %sext769}770 771define i64 @atomic_load_seq_cst_i16_sext_i64(ptr %ptr) {772; MIPS32-LABEL: atomic_load_seq_cst_i16_sext_i64:773; MIPS32: # %bb.0:774; MIPS32-NEXT: lhu $1, 0($4)775; MIPS32-NEXT: sync776; MIPS32-NEXT: sll $1, $1, 16777; MIPS32-NEXT: sra $2, $1, 16778; MIPS32-NEXT: jr $ra779; MIPS32-NEXT: sra $3, $1, 31780 %load = load atomic i16, ptr %ptr seq_cst, align 2781 %sext = sext i16 %load to i64782 ret i64 %sext783}784 785define i32 @atomic_load_seq_cst_i16_zext_i32(ptr %ptr) {786; MIPS32-LABEL: atomic_load_seq_cst_i16_zext_i32:787; MIPS32: # %bb.0:788; MIPS32-NEXT: lhu $1, 0($4)789; MIPS32-NEXT: sync790; MIPS32-NEXT: jr $ra791; MIPS32-NEXT: andi $2, $1, 65535792 %load = load atomic i16, ptr %ptr seq_cst, align 2793 %zext = zext i16 %load to i32794 ret i32 %zext795}796 797define i64 @atomic_load_seq_cst_i16_zext_i64(ptr %ptr) {798; MIPS32-LABEL: atomic_load_seq_cst_i16_zext_i64:799; MIPS32: # %bb.0:800; MIPS32-NEXT: lhu $1, 0($4)801; MIPS32-NEXT: sync802; MIPS32-NEXT: andi $2, $1, 65535803; MIPS32-NEXT: jr $ra804; MIPS32-NEXT: andi $3, $1, 0805 %load = load atomic i16, ptr %ptr seq_cst, align 2806 %zext = zext i16 %load to i64807 ret i64 %zext808}809 810define i32 @atomic_load_seq_cst_i32(ptr %ptr) {811; MIPS32-LABEL: atomic_load_seq_cst_i32:812; MIPS32: # %bb.0:813; MIPS32-NEXT: lw $2, 0($4)814; MIPS32-NEXT: sync815; MIPS32-NEXT: jr $ra816; MIPS32-NEXT: nop817 %load = load atomic i32, ptr %ptr seq_cst, align 4818 ret i32 %load819}820 821define i64 @atomic_load_seq_cst_i64(ptr %ptr) {822; MIPS32-LABEL: atomic_load_seq_cst_i64:823; MIPS32: # %bb.0:824; MIPS32-NEXT: addiu $sp, $sp, -24825; MIPS32-NEXT: .cfi_def_cfa_offset 24826; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill827; MIPS32-NEXT: .cfi_offset 31, -4828; MIPS32-NEXT: jal __atomic_load_8829; MIPS32-NEXT: ori $5, $zero, 5830; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload831; MIPS32-NEXT: jr $ra832; MIPS32-NEXT: addiu $sp, $sp, 24833 %load = load atomic i64, ptr %ptr seq_cst, align 8834 ret i64 %load835}836 837define float @atomic_load_seq_cst_f32(ptr %ptr) {838; MIPS32-LABEL: atomic_load_seq_cst_f32:839; MIPS32: # %bb.0:840; MIPS32-NEXT: lwc1 $f0, 64($4)841; MIPS32-NEXT: sync842; MIPS32-NEXT: jr $ra843; MIPS32-NEXT: nop844 %gep = getelementptr inbounds float, ptr %ptr, i32 16845 %load = load atomic float, ptr %gep seq_cst, align 4846 ret float %load847}848 849define double @atomic_load_seq_cst_f64(ptr %ptr) {850; MIPS32-LABEL: atomic_load_seq_cst_f64:851; MIPS32: # %bb.0:852; MIPS32-NEXT: addiu $sp, $sp, -24853; MIPS32-NEXT: .cfi_def_cfa_offset 24854; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill855; MIPS32-NEXT: .cfi_offset 31, -4856; MIPS32-NEXT: ori $5, $zero, 5857; MIPS32-NEXT: ori $1, $zero, 128858; MIPS32-NEXT: jal __atomic_load_8859; MIPS32-NEXT: addu $4, $4, $1860; MIPS32-NEXT: mtc1 $2, $f0861; MIPS32-NEXT: mtc1 $3, $f1862; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload863; MIPS32-NEXT: jr $ra864; MIPS32-NEXT: addiu $sp, $sp, 24865 %gep = getelementptr inbounds double, ptr %ptr, i32 16866 %load = load atomic double, ptr %gep seq_cst, align 8867 ret double %load868}869 870define ptr @atomic_load_seq_cst_p0i8(ptr %ptr) {871; MIPS32-LABEL: atomic_load_seq_cst_p0i8:872; MIPS32: # %bb.0:873; MIPS32-NEXT: lw $2, 64($4)874; MIPS32-NEXT: sync875; MIPS32-NEXT: jr $ra876; MIPS32-NEXT: nop877 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16878 %load = load atomic ptr, ptr %gep seq_cst, align 4879 ret ptr %load880}881