1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -global-isel -mtriple=mipsel-linux-gnu -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32 3 4; -------------------------------------------------------------------- 5; unordered 6; -------------------------------------------------------------------- 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 $ra 13; MIPS32-NEXT: nop 14 %load = load atomic i8, ptr %ptr unordered, align 1 15 ret i8 %load 16} 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, 24 23; MIPS32-NEXT: jr $ra 24; MIPS32-NEXT: sra $2, $1, 24 25 %load = load atomic i8, ptr %ptr unordered, align 1 26 %sext = sext i8 %load to i32 27 ret i32 %sext 28} 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, 24 35; MIPS32-NEXT: jr $ra 36; MIPS32-NEXT: sra $2, $1, 24 37 %load = load atomic i8, ptr %ptr unordered, align 1 38 %sext = sext i8 %load to i16 39 ret i16 %sext 40} 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, 24 47; MIPS32-NEXT: sra $2, $1, 24 48; MIPS32-NEXT: jr $ra 49; MIPS32-NEXT: sra $3, $1, 31 50 %load = load atomic i8, ptr %ptr unordered, align 1 51 %sext = sext i8 %load to i64 52 ret i64 %sext 53} 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 $ra 60; MIPS32-NEXT: andi $2, $1, 255 61 %load = load atomic i8, ptr %ptr unordered, align 1 62 %zext = zext i8 %load to i32 63 ret i32 %zext 64} 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 $ra 71; MIPS32-NEXT: andi $2, $1, 255 72 %load = load atomic i8, ptr %ptr unordered, align 1 73 %zext = zext i8 %load to i16 74 ret i16 %zext 75} 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, 255 82; MIPS32-NEXT: jr $ra 83; MIPS32-NEXT: andi $3, $1, 0 84 %load = load atomic i8, ptr %ptr unordered, align 1 85 %zext = zext i8 %load to i64 86 ret i64 %zext 87} 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 $ra 94; MIPS32-NEXT: nop 95 %load = load atomic i16, ptr %ptr unordered, align 2 96 ret i16 %load 97} 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, 16 104; MIPS32-NEXT: jr $ra 105; MIPS32-NEXT: sra $2, $1, 16 106 %load = load atomic i16, ptr %ptr unordered, align 2 107 %sext = sext i16 %load to i32 108 ret i32 %sext 109} 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, 16 116; MIPS32-NEXT: sra $2, $1, 16 117; MIPS32-NEXT: jr $ra 118; MIPS32-NEXT: sra $3, $1, 31 119 %load = load atomic i16, ptr %ptr unordered, align 2 120 %sext = sext i16 %load to i64 121 ret i64 %sext 122} 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 $ra 129; MIPS32-NEXT: andi $2, $1, 65535 130 %load = load atomic i16, ptr %ptr unordered, align 2 131 %zext = zext i16 %load to i32 132 ret i32 %zext 133} 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, 65535 140; MIPS32-NEXT: jr $ra 141; MIPS32-NEXT: andi $3, $1, 0 142 %load = load atomic i16, ptr %ptr unordered, align 2 143 %zext = zext i16 %load to i64 144 ret i64 %zext 145} 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 $ra 152; MIPS32-NEXT: nop 153 %load = load atomic i32, ptr %ptr unordered, align 4 154 ret i32 %load 155} 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, -24 161; MIPS32-NEXT: .cfi_def_cfa_offset 24 162; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 163; MIPS32-NEXT: .cfi_offset 31, -4 164; MIPS32-NEXT: jal __atomic_load_8 165; MIPS32-NEXT: ori $5, $zero, 0 166; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 167; MIPS32-NEXT: jr $ra 168; MIPS32-NEXT: addiu $sp, $sp, 24 169 %load = load atomic i64, ptr %ptr unordered, align 8 170 ret i64 %load 171} 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 $ra 178; MIPS32-NEXT: nop 179 %gep = getelementptr inbounds float, ptr %ptr, i32 16 180 %load = load atomic float, ptr %gep unordered, align 4 181 ret float %load 182} 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, -24 188; MIPS32-NEXT: .cfi_def_cfa_offset 24 189; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 190; MIPS32-NEXT: .cfi_offset 31, -4 191; MIPS32-NEXT: ori $5, $zero, 0 192; MIPS32-NEXT: ori $1, $zero, 128 193; MIPS32-NEXT: jal __atomic_load_8 194; MIPS32-NEXT: addu $4, $4, $1 195; MIPS32-NEXT: mtc1 $2, $f0 196; MIPS32-NEXT: mtc1 $3, $f1 197; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 198; MIPS32-NEXT: jr $ra 199; MIPS32-NEXT: addiu $sp, $sp, 24 200 %gep = getelementptr inbounds double, ptr %ptr, i32 16 201 %load = load atomic double, ptr %gep unordered, align 8 202 ret double %load 203} 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 $ra 210; MIPS32-NEXT: nop 211 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16 212 %load = load atomic ptr, ptr %gep unordered, align 4 213 ret ptr %load 214} 215 216; -------------------------------------------------------------------- 217; monotonic 218; -------------------------------------------------------------------- 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 $ra 225; MIPS32-NEXT: nop 226 %load = load atomic i8, ptr %ptr monotonic, align 1 227 ret i8 %load 228} 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, 24 235; MIPS32-NEXT: jr $ra 236; MIPS32-NEXT: sra $2, $1, 24 237 %load = load atomic i8, ptr %ptr monotonic, align 1 238 %sext = sext i8 %load to i32 239 ret i32 %sext 240} 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, 24 247; MIPS32-NEXT: jr $ra 248; MIPS32-NEXT: sra $2, $1, 24 249 %load = load atomic i8, ptr %ptr monotonic, align 1 250 %sext = sext i8 %load to i16 251 ret i16 %sext 252} 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, 24 259; MIPS32-NEXT: sra $2, $1, 24 260; MIPS32-NEXT: jr $ra 261; MIPS32-NEXT: sra $3, $1, 31 262 %load = load atomic i8, ptr %ptr monotonic, align 1 263 %sext = sext i8 %load to i64 264 ret i64 %sext 265} 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 $ra 272; MIPS32-NEXT: andi $2, $1, 255 273 %load = load atomic i8, ptr %ptr monotonic, align 1 274 %zext = zext i8 %load to i32 275 ret i32 %zext 276} 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 $ra 283; MIPS32-NEXT: andi $2, $1, 255 284 %load = load atomic i8, ptr %ptr monotonic, align 1 285 %zext = zext i8 %load to i16 286 ret i16 %zext 287} 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, 255 294; MIPS32-NEXT: jr $ra 295; MIPS32-NEXT: andi $3, $1, 0 296 %load = load atomic i8, ptr %ptr monotonic, align 1 297 %zext = zext i8 %load to i64 298 ret i64 %zext 299} 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 $ra 306; MIPS32-NEXT: nop 307 %load = load atomic i16, ptr %ptr monotonic, align 2 308 ret i16 %load 309} 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, 16 316; MIPS32-NEXT: jr $ra 317; MIPS32-NEXT: sra $2, $1, 16 318 %load = load atomic i16, ptr %ptr monotonic, align 2 319 %sext = sext i16 %load to i32 320 ret i32 %sext 321} 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, 16 328; MIPS32-NEXT: sra $2, $1, 16 329; MIPS32-NEXT: jr $ra 330; MIPS32-NEXT: sra $3, $1, 31 331 %load = load atomic i16, ptr %ptr monotonic, align 2 332 %sext = sext i16 %load to i64 333 ret i64 %sext 334} 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 $ra 341; MIPS32-NEXT: andi $2, $1, 65535 342 %load = load atomic i16, ptr %ptr monotonic, align 2 343 %zext = zext i16 %load to i32 344 ret i32 %zext 345} 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, 65535 352; MIPS32-NEXT: jr $ra 353; MIPS32-NEXT: andi $3, $1, 0 354 %load = load atomic i16, ptr %ptr monotonic, align 2 355 %zext = zext i16 %load to i64 356 ret i64 %zext 357} 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 $ra 364; MIPS32-NEXT: nop 365 %load = load atomic i32, ptr %ptr monotonic, align 4 366 ret i32 %load 367} 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, -24 373; MIPS32-NEXT: .cfi_def_cfa_offset 24 374; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 375; MIPS32-NEXT: .cfi_offset 31, -4 376; MIPS32-NEXT: jal __atomic_load_8 377; MIPS32-NEXT: ori $5, $zero, 0 378; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 379; MIPS32-NEXT: jr $ra 380; MIPS32-NEXT: addiu $sp, $sp, 24 381 %load = load atomic i64, ptr %ptr monotonic, align 8 382 ret i64 %load 383} 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 $ra 390; MIPS32-NEXT: nop 391 %gep = getelementptr inbounds float, ptr %ptr, i32 16 392 %load = load atomic float, ptr %gep monotonic, align 4 393 ret float %load 394} 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, -24 400; MIPS32-NEXT: .cfi_def_cfa_offset 24 401; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 402; MIPS32-NEXT: .cfi_offset 31, -4 403; MIPS32-NEXT: ori $5, $zero, 0 404; MIPS32-NEXT: ori $1, $zero, 128 405; MIPS32-NEXT: jal __atomic_load_8 406; MIPS32-NEXT: addu $4, $4, $1 407; MIPS32-NEXT: mtc1 $2, $f0 408; MIPS32-NEXT: mtc1 $3, $f1 409; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 410; MIPS32-NEXT: jr $ra 411; MIPS32-NEXT: addiu $sp, $sp, 24 412 %gep = getelementptr inbounds double, ptr %ptr, i32 16 413 %load = load atomic double, ptr %gep monotonic, align 8 414 ret double %load 415} 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 $ra 422; MIPS32-NEXT: nop 423 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16 424 %load = load atomic ptr, ptr %gep monotonic, align 4 425 ret ptr %load 426} 427 428; -------------------------------------------------------------------- 429; acquire 430; -------------------------------------------------------------------- 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: sync 437; MIPS32-NEXT: jr $ra 438; MIPS32-NEXT: nop 439 %load = load atomic i8, ptr %ptr acquire, align 1 440 ret i8 %load 441} 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: sync 448; MIPS32-NEXT: sll $1, $1, 24 449; MIPS32-NEXT: jr $ra 450; MIPS32-NEXT: sra $2, $1, 24 451 %load = load atomic i8, ptr %ptr acquire, align 1 452 %sext = sext i8 %load to i32 453 ret i32 %sext 454} 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: sync 461; MIPS32-NEXT: sll $1, $1, 24 462; MIPS32-NEXT: jr $ra 463; MIPS32-NEXT: sra $2, $1, 24 464 %load = load atomic i8, ptr %ptr acquire, align 1 465 %sext = sext i8 %load to i16 466 ret i16 %sext 467} 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: sync 474; MIPS32-NEXT: sll $1, $1, 24 475; MIPS32-NEXT: sra $2, $1, 24 476; MIPS32-NEXT: jr $ra 477; MIPS32-NEXT: sra $3, $1, 31 478 %load = load atomic i8, ptr %ptr acquire, align 1 479 %sext = sext i8 %load to i64 480 ret i64 %sext 481} 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: sync 488; MIPS32-NEXT: jr $ra 489; MIPS32-NEXT: andi $2, $1, 255 490 %load = load atomic i8, ptr %ptr acquire, align 1 491 %zext = zext i8 %load to i32 492 ret i32 %zext 493} 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: sync 500; MIPS32-NEXT: jr $ra 501; MIPS32-NEXT: andi $2, $1, 255 502 %load = load atomic i8, ptr %ptr acquire, align 1 503 %zext = zext i8 %load to i16 504 ret i16 %zext 505} 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: sync 512; MIPS32-NEXT: andi $2, $1, 255 513; MIPS32-NEXT: jr $ra 514; MIPS32-NEXT: andi $3, $1, 0 515 %load = load atomic i8, ptr %ptr acquire, align 1 516 %zext = zext i8 %load to i64 517 ret i64 %zext 518} 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: sync 525; MIPS32-NEXT: jr $ra 526; MIPS32-NEXT: nop 527 %load = load atomic i16, ptr %ptr acquire, align 2 528 ret i16 %load 529} 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: sync 536; MIPS32-NEXT: sll $1, $1, 16 537; MIPS32-NEXT: jr $ra 538; MIPS32-NEXT: sra $2, $1, 16 539 %load = load atomic i16, ptr %ptr acquire, align 2 540 %sext = sext i16 %load to i32 541 ret i32 %sext 542} 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: sync 549; MIPS32-NEXT: sll $1, $1, 16 550; MIPS32-NEXT: sra $2, $1, 16 551; MIPS32-NEXT: jr $ra 552; MIPS32-NEXT: sra $3, $1, 31 553 %load = load atomic i16, ptr %ptr acquire, align 2 554 %sext = sext i16 %load to i64 555 ret i64 %sext 556} 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: sync 563; MIPS32-NEXT: jr $ra 564; MIPS32-NEXT: andi $2, $1, 65535 565 %load = load atomic i16, ptr %ptr acquire, align 2 566 %zext = zext i16 %load to i32 567 ret i32 %zext 568} 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: sync 575; MIPS32-NEXT: andi $2, $1, 65535 576; MIPS32-NEXT: jr $ra 577; MIPS32-NEXT: andi $3, $1, 0 578 %load = load atomic i16, ptr %ptr acquire, align 2 579 %zext = zext i16 %load to i64 580 ret i64 %zext 581} 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: sync 588; MIPS32-NEXT: jr $ra 589; MIPS32-NEXT: nop 590 %load = load atomic i32, ptr %ptr acquire, align 4 591 ret i32 %load 592} 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, -24 598; MIPS32-NEXT: .cfi_def_cfa_offset 24 599; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 600; MIPS32-NEXT: .cfi_offset 31, -4 601; MIPS32-NEXT: jal __atomic_load_8 602; MIPS32-NEXT: ori $5, $zero, 2 603; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 604; MIPS32-NEXT: jr $ra 605; MIPS32-NEXT: addiu $sp, $sp, 24 606 %load = load atomic i64, ptr %ptr acquire, align 8 607 ret i64 %load 608} 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: sync 615; MIPS32-NEXT: jr $ra 616; MIPS32-NEXT: nop 617 %gep = getelementptr inbounds float, ptr %ptr, i32 16 618 %load = load atomic float, ptr %gep acquire, align 4 619 ret float %load 620} 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, -24 626; MIPS32-NEXT: .cfi_def_cfa_offset 24 627; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 628; MIPS32-NEXT: .cfi_offset 31, -4 629; MIPS32-NEXT: ori $5, $zero, 2 630; MIPS32-NEXT: ori $1, $zero, 128 631; MIPS32-NEXT: jal __atomic_load_8 632; MIPS32-NEXT: addu $4, $4, $1 633; MIPS32-NEXT: mtc1 $2, $f0 634; MIPS32-NEXT: mtc1 $3, $f1 635; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 636; MIPS32-NEXT: jr $ra 637; MIPS32-NEXT: addiu $sp, $sp, 24 638 %gep = getelementptr inbounds double, ptr %ptr, i32 16 639 %load = load atomic double, ptr %gep acquire, align 8 640 ret double %load 641} 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: sync 648; MIPS32-NEXT: jr $ra 649; MIPS32-NEXT: nop 650 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16 651 %load = load atomic ptr, ptr %gep acquire, align 4 652 ret ptr %load 653} 654 655; -------------------------------------------------------------------- 656; seq_cst 657; -------------------------------------------------------------------- 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: sync 664; MIPS32-NEXT: jr $ra 665; MIPS32-NEXT: nop 666 %load = load atomic i8, ptr %ptr seq_cst, align 1 667 ret i8 %load 668} 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: sync 675; MIPS32-NEXT: sll $1, $1, 24 676; MIPS32-NEXT: jr $ra 677; MIPS32-NEXT: sra $2, $1, 24 678 %load = load atomic i8, ptr %ptr seq_cst, align 1 679 %sext = sext i8 %load to i32 680 ret i32 %sext 681} 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: sync 688; MIPS32-NEXT: sll $1, $1, 24 689; MIPS32-NEXT: jr $ra 690; MIPS32-NEXT: sra $2, $1, 24 691 %load = load atomic i8, ptr %ptr seq_cst, align 1 692 %sext = sext i8 %load to i16 693 ret i16 %sext 694} 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: sync 701; MIPS32-NEXT: sll $1, $1, 24 702; MIPS32-NEXT: sra $2, $1, 24 703; MIPS32-NEXT: jr $ra 704; MIPS32-NEXT: sra $3, $1, 31 705 %load = load atomic i8, ptr %ptr seq_cst, align 1 706 %sext = sext i8 %load to i64 707 ret i64 %sext 708} 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: sync 715; MIPS32-NEXT: jr $ra 716; MIPS32-NEXT: andi $2, $1, 255 717 %load = load atomic i8, ptr %ptr seq_cst, align 1 718 %zext = zext i8 %load to i32 719 ret i32 %zext 720} 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: sync 727; MIPS32-NEXT: jr $ra 728; MIPS32-NEXT: andi $2, $1, 255 729 %load = load atomic i8, ptr %ptr seq_cst, align 1 730 %zext = zext i8 %load to i16 731 ret i16 %zext 732} 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: sync 739; MIPS32-NEXT: andi $2, $1, 255 740; MIPS32-NEXT: jr $ra 741; MIPS32-NEXT: andi $3, $1, 0 742 %load = load atomic i8, ptr %ptr seq_cst, align 1 743 %zext = zext i8 %load to i64 744 ret i64 %zext 745} 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: sync 752; MIPS32-NEXT: jr $ra 753; MIPS32-NEXT: nop 754 %load = load atomic i16, ptr %ptr seq_cst, align 2 755 ret i16 %load 756} 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: sync 763; MIPS32-NEXT: sll $1, $1, 16 764; MIPS32-NEXT: jr $ra 765; MIPS32-NEXT: sra $2, $1, 16 766 %load = load atomic i16, ptr %ptr seq_cst, align 2 767 %sext = sext i16 %load to i32 768 ret i32 %sext 769} 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: sync 776; MIPS32-NEXT: sll $1, $1, 16 777; MIPS32-NEXT: sra $2, $1, 16 778; MIPS32-NEXT: jr $ra 779; MIPS32-NEXT: sra $3, $1, 31 780 %load = load atomic i16, ptr %ptr seq_cst, align 2 781 %sext = sext i16 %load to i64 782 ret i64 %sext 783} 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: sync 790; MIPS32-NEXT: jr $ra 791; MIPS32-NEXT: andi $2, $1, 65535 792 %load = load atomic i16, ptr %ptr seq_cst, align 2 793 %zext = zext i16 %load to i32 794 ret i32 %zext 795} 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: sync 802; MIPS32-NEXT: andi $2, $1, 65535 803; MIPS32-NEXT: jr $ra 804; MIPS32-NEXT: andi $3, $1, 0 805 %load = load atomic i16, ptr %ptr seq_cst, align 2 806 %zext = zext i16 %load to i64 807 ret i64 %zext 808} 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: sync 815; MIPS32-NEXT: jr $ra 816; MIPS32-NEXT: nop 817 %load = load atomic i32, ptr %ptr seq_cst, align 4 818 ret i32 %load 819} 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, -24 825; MIPS32-NEXT: .cfi_def_cfa_offset 24 826; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 827; MIPS32-NEXT: .cfi_offset 31, -4 828; MIPS32-NEXT: jal __atomic_load_8 829; MIPS32-NEXT: ori $5, $zero, 5 830; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 831; MIPS32-NEXT: jr $ra 832; MIPS32-NEXT: addiu $sp, $sp, 24 833 %load = load atomic i64, ptr %ptr seq_cst, align 8 834 ret i64 %load 835} 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: sync 842; MIPS32-NEXT: jr $ra 843; MIPS32-NEXT: nop 844 %gep = getelementptr inbounds float, ptr %ptr, i32 16 845 %load = load atomic float, ptr %gep seq_cst, align 4 846 ret float %load 847} 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, -24 853; MIPS32-NEXT: .cfi_def_cfa_offset 24 854; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 855; MIPS32-NEXT: .cfi_offset 31, -4 856; MIPS32-NEXT: ori $5, $zero, 5 857; MIPS32-NEXT: ori $1, $zero, 128 858; MIPS32-NEXT: jal __atomic_load_8 859; MIPS32-NEXT: addu $4, $4, $1 860; MIPS32-NEXT: mtc1 $2, $f0 861; MIPS32-NEXT: mtc1 $3, $f1 862; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 863; MIPS32-NEXT: jr $ra 864; MIPS32-NEXT: addiu $sp, $sp, 24 865 %gep = getelementptr inbounds double, ptr %ptr, i32 16 866 %load = load atomic double, ptr %gep seq_cst, align 8 867 ret double %load 868} 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: sync 875; MIPS32-NEXT: jr $ra 876; MIPS32-NEXT: nop 877 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16 878 %load = load atomic ptr, ptr %gep seq_cst, align 4 879 ret ptr %load 880} 881