97 lines · plain
1; Tests for lrint and llrint, with both i32 and i64 checked.2 3; RUN: sed 's/ITy/i32/g' %s | llc -mtriple=loongarch32 | FileCheck %s --check-prefixes=LA324; RUN: sed 's/ITy/i64/g' %s | llc -mtriple=loongarch32 | FileCheck %s --check-prefixes=LA325; RUN: sed 's/ITy/i32/g' %s | llc -mtriple=loongarch64 | FileCheck %s --check-prefixes=LA64-I326; RUN: sed 's/ITy/i64/g' %s | llc -mtriple=loongarch64 | FileCheck %s --check-prefixes=LA64-I647 8; FIXME: crash9; define ITy @test_lrint_ixx_f16(half %x) nounwind {10; %res = tail call ITy @llvm.lrint.ITy.f16(half %x)11; ret ITy %res12; }13 14; define ITy @test_llrint_ixx_f16(half %x) nounwind {15; %res = tail call ITy @llvm.llrint.ITy.f16(half %x)16; ret ITy %res17; }18 19define ITy @test_lrint_ixx_f32(float %x) nounwind {20; LA32-LABEL: test_lrint_ixx_f32:21; LA32: bl lrintf22;23; LA64-I32-LABEL: test_lrint_ixx_f32:24; LA64-I32: pcaddu18i $ra, %call36(lrintf)25;26; LA64-I64-LABEL: test_lrint_ixx_f32:27; LA64-I64: pcaddu18i $t8, %call36(lrintf)28 %res = tail call ITy @llvm.lrint.ITy.f32(float %x)29 ret ITy %res30}31 32define ITy @test_llrint_ixx_f32(float %x) nounwind {33; LA32-LABEL: test_llrint_ixx_f32:34; LA32: bl llrintf35;36; LA64-I32-LABEL: test_llrint_ixx_f32:37; LA64-I32: pcaddu18i $ra, %call36(llrintf)38;39; LA64-I64-LABEL: test_llrint_ixx_f32:40; LA64-I64: pcaddu18i $t8, %call36(llrintf)41 %res = tail call ITy @llvm.llrint.ITy.f32(float %x)42 ret ITy %res43}44 45define ITy @test_lrint_ixx_f64(double %x) nounwind {46; LA32-LABEL: test_lrint_ixx_f64:47; LA32: bl lrint48;49; LA64-I32-LABEL: test_lrint_ixx_f64:50; LA64-I32: pcaddu18i $ra, %call36(lrint)51;52; LA64-I64-LABEL: test_lrint_ixx_f64:53; LA64-I64: pcaddu18i $t8, %call36(lrint)54 %res = tail call ITy @llvm.lrint.ITy.f64(double %x)55 ret ITy %res56}57 58define ITy @test_llrint_ixx_f64(double %x) nounwind {59; LA32-LABEL: test_llrint_ixx_f64:60; LA32: bl llrint61;62; LA64-I32-LABEL: test_llrint_ixx_f64:63; LA64-I32: pcaddu18i $ra, %call36(llrint)64;65; LA64-I64-LABEL: test_llrint_ixx_f64:66; LA64-I64: pcaddu18i $t8, %call36(llrint)67 %res = tail call ITy @llvm.llrint.ITy.f64(double %x)68 ret ITy %res69}70 71; FIXME(#44744): incorrect libcall on loongarch3272define ITy @test_lrint_ixx_f128(fp128 %x) nounwind {73; LA32-LABEL: test_lrint_ixx_f128:74; LA32: bl lrintl75;76; LA64-I32-LABEL: test_lrint_ixx_f128:77; LA64-I32: pcaddu18i $ra, %call36(lrintl)78;79; LA64-I64-LABEL: test_lrint_ixx_f128:80; LA64-I64: pcaddu18i $ra, %call36(lrintl)81 %res = tail call ITy @llvm.lrint.ITy.f128(fp128 %x)82 ret ITy %res83}84 85define ITy @test_llrint_ixx_f128(fp128 %x) nounwind {86; LA32-LABEL: test_llrint_ixx_f128:87; LA32: bl llrintl88;89; LA64-I32-LABEL: test_llrint_ixx_f128:90; LA64-I32: pcaddu18i $ra, %call36(llrintl)91;92; LA64-I64-LABEL: test_llrint_ixx_f128:93; LA64-I64: pcaddu18i $ra, %call36(llrintl)94 %res = tail call ITy @llvm.llrint.ITy.f128(fp128 %x)95 ret ITy %res96}97