1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ 3; RUN: | FileCheck -check-prefix=RV32I %s 4 5@x = local_unnamed_addr global fp128 0xL00000000000000007FFF000000000000, align 16 6@y = local_unnamed_addr global fp128 0xL00000000000000007FFF000000000000, align 16 7 8; Besides anything else, these tests help verify that libcall ABI lowering 9; works correctly 10 11define i32 @test_load_and_cmp() nounwind { 12; RV32I-LABEL: test_load_and_cmp: 13; RV32I: # %bb.0: 14; RV32I-NEXT: addi sp, sp, -48 15; RV32I-NEXT: sw ra, 44(sp) 16; RV32I-NEXT: lui a0, %hi(x) 17; RV32I-NEXT: lw a6, %lo(x)(a0) 18; RV32I-NEXT: lw a7, %lo(x+4)(a0) 19; RV32I-NEXT: lw a3, %lo(x+8)(a0) 20; RV32I-NEXT: lw a0, %lo(x+12)(a0) 21; RV32I-NEXT: lui a4, %hi(y) 22; RV32I-NEXT: lw a5, %lo(y)(a4) 23; RV32I-NEXT: lw a2, %lo(y+4)(a4) 24; RV32I-NEXT: lw a1, %lo(y+8)(a4) 25; RV32I-NEXT: lw a4, %lo(y+12)(a4) 26; RV32I-NEXT: sw a4, 20(sp) 27; RV32I-NEXT: sw a1, 16(sp) 28; RV32I-NEXT: sw a2, 12(sp) 29; RV32I-NEXT: sw a5, 8(sp) 30; RV32I-NEXT: sw a0, 36(sp) 31; RV32I-NEXT: sw a3, 32(sp) 32; RV32I-NEXT: sw a7, 28(sp) 33; RV32I-NEXT: addi a0, sp, 24 34; RV32I-NEXT: addi a1, sp, 8 35; RV32I-NEXT: sw a6, 24(sp) 36; RV32I-NEXT: call __netf2 37; RV32I-NEXT: snez a0, a0 38; RV32I-NEXT: lw ra, 44(sp) 39; RV32I-NEXT: addi sp, sp, 48 40; RV32I-NEXT: ret 41 %1 = load fp128, fp128* @x, align 16 42 %2 = load fp128, fp128* @y, align 16 43 %cmp = fcmp une fp128 %1, %2 44 %3 = zext i1 %cmp to i32 45 ret i32 %3 46} 47 48define i32 @test_add_and_fptosi() nounwind { 49; RV32I-LABEL: test_add_and_fptosi: 50; RV32I: # %bb.0: 51; RV32I-NEXT: addi sp, sp, -80 52; RV32I-NEXT: sw ra, 76(sp) 53; RV32I-NEXT: lui a0, %hi(x) 54; RV32I-NEXT: lw a6, %lo(x)(a0) 55; RV32I-NEXT: lw a7, %lo(x+4)(a0) 56; RV32I-NEXT: lw a2, %lo(x+8)(a0) 57; RV32I-NEXT: lw a0, %lo(x+12)(a0) 58; RV32I-NEXT: lui a4, %hi(y) 59; RV32I-NEXT: lw a5, %lo(y)(a4) 60; RV32I-NEXT: lw a3, %lo(y+4)(a4) 61; RV32I-NEXT: lw a1, %lo(y+8)(a4) 62; RV32I-NEXT: lw a4, %lo(y+12)(a4) 63; RV32I-NEXT: sw a4, 36(sp) 64; RV32I-NEXT: sw a1, 32(sp) 65; RV32I-NEXT: sw a3, 28(sp) 66; RV32I-NEXT: sw a5, 24(sp) 67; RV32I-NEXT: sw a0, 52(sp) 68; RV32I-NEXT: sw a2, 48(sp) 69; RV32I-NEXT: sw a7, 44(sp) 70; RV32I-NEXT: addi a0, sp, 56 71; RV32I-NEXT: addi a1, sp, 40 72; RV32I-NEXT: addi a2, sp, 24 73; RV32I-NEXT: sw a6, 40(sp) 74; RV32I-NEXT: call __addtf3 75; RV32I-NEXT: lw a1, 56(sp) 76; RV32I-NEXT: lw a0, 60(sp) 77; RV32I-NEXT: lw a2, 64(sp) 78; RV32I-NEXT: lw a3, 68(sp) 79; RV32I-NEXT: sw a3, 20(sp) 80; RV32I-NEXT: sw a2, 16(sp) 81; RV32I-NEXT: sw a0, 12(sp) 82; RV32I-NEXT: addi a0, sp, 8 83; RV32I-NEXT: sw a1, 8(sp) 84; RV32I-NEXT: call __fixtfsi 85; RV32I-NEXT: lw ra, 76(sp) 86; RV32I-NEXT: addi sp, sp, 80 87; RV32I-NEXT: ret 88 %1 = load fp128, fp128* @x, align 16 89 %2 = load fp128, fp128* @y, align 16 90 %3 = fadd fp128 %1, %2 91 %4 = fptosi fp128 %3 to i32 92 ret i32 %4 93} 94