brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.9 KiB · 21382e2 Raw
368 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=aarch64 | FileCheck %s --check-prefixes=CHECK,CHECK-CVT3; RUN: llc < %s -mtriple=aarch64 -mattr=+fullfp16 | FileCheck %s --check-prefixes=CHECK,CHECK-FP164 5; Round towards minus infinity (fcvtmu).6 7define i32 @testmuwh(half %a) {8; CHECK-CVT-LABEL: testmuwh:9; CHECK-CVT:       // %bb.0: // %entry10; CHECK-CVT-NEXT:    fcvt s0, h011; CHECK-CVT-NEXT:    frintm s0, s012; CHECK-CVT-NEXT:    fcvt h0, s013; CHECK-CVT-NEXT:    fcvt s0, h014; CHECK-CVT-NEXT:    fcvtzu w0, s015; CHECK-CVT-NEXT:    ret16;17; CHECK-FP16-LABEL: testmuwh:18; CHECK-FP16:       // %bb.0: // %entry19; CHECK-FP16-NEXT:    fcvtmu w0, h020; CHECK-FP16-NEXT:    ret21entry:22  %r = call half @llvm.floor.f16(half %a) nounwind readnone23  %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)24  ret i32 %i25}26 27define i64 @testmuxh(half %a) {28; CHECK-CVT-LABEL: testmuxh:29; CHECK-CVT:       // %bb.0: // %entry30; CHECK-CVT-NEXT:    fcvt s0, h031; CHECK-CVT-NEXT:    frintm s0, s032; CHECK-CVT-NEXT:    fcvt h0, s033; CHECK-CVT-NEXT:    fcvt s0, h034; CHECK-CVT-NEXT:    fcvtzu x0, s035; CHECK-CVT-NEXT:    ret36;37; CHECK-FP16-LABEL: testmuxh:38; CHECK-FP16:       // %bb.0: // %entry39; CHECK-FP16-NEXT:    fcvtmu x0, h040; CHECK-FP16-NEXT:    ret41entry:42  %r = call half @llvm.floor.f16(half %a) nounwind readnone43  %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)44  ret i64 %i45}46 47define i32 @testmuws(float %a) {48; CHECK-LABEL: testmuws:49; CHECK:       // %bb.0: // %entry50; CHECK-NEXT:    fcvtmu w0, s051; CHECK-NEXT:    ret52entry:53  %r = call float @floorf(float %a) nounwind readnone54  %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)55  ret i32 %i56}57 58define i64 @testmuxs(float %a) {59; CHECK-LABEL: testmuxs:60; CHECK:       // %bb.0: // %entry61; CHECK-NEXT:    fcvtmu x0, s062; CHECK-NEXT:    ret63entry:64  %r = call float @floorf(float %a) nounwind readnone65  %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)66  ret i64 %i67}68 69define i32 @testmuwd(double %a) {70; CHECK-LABEL: testmuwd:71; CHECK:       // %bb.0: // %entry72; CHECK-NEXT:    fcvtmu w0, d073; CHECK-NEXT:    ret74entry:75  %r = call double @floor(double %a) nounwind readnone76  %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)77  ret i32 %i78}79 80define i64 @testmuxd(double %a) {81; CHECK-LABEL: testmuxd:82; CHECK:       // %bb.0: // %entry83; CHECK-NEXT:    fcvtmu x0, d084; CHECK-NEXT:    ret85entry:86  %r = call double @floor(double %a) nounwind readnone87  %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)88  ret i64 %i89}90 91; Round towards plus infinity (fcvtpu).92 93define i32 @testpuwh(half %a) {94; CHECK-CVT-LABEL: testpuwh:95; CHECK-CVT:       // %bb.0: // %entry96; CHECK-CVT-NEXT:    fcvt s0, h097; CHECK-CVT-NEXT:    frintp s0, s098; CHECK-CVT-NEXT:    fcvt h0, s099; CHECK-CVT-NEXT:    fcvt s0, h0100; CHECK-CVT-NEXT:    fcvtzu w0, s0101; CHECK-CVT-NEXT:    ret102;103; CHECK-FP16-LABEL: testpuwh:104; CHECK-FP16:       // %bb.0: // %entry105; CHECK-FP16-NEXT:    fcvtpu w0, h0106; CHECK-FP16-NEXT:    ret107entry:108  %r = call half @llvm.ceil.f16(half %a) nounwind readnone109  %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)110  ret i32 %i111}112 113define i64 @testpuxh(half %a) {114; CHECK-CVT-LABEL: testpuxh:115; CHECK-CVT:       // %bb.0: // %entry116; CHECK-CVT-NEXT:    fcvt s0, h0117; CHECK-CVT-NEXT:    frintp s0, s0118; CHECK-CVT-NEXT:    fcvt h0, s0119; CHECK-CVT-NEXT:    fcvt s0, h0120; CHECK-CVT-NEXT:    fcvtzu x0, s0121; CHECK-CVT-NEXT:    ret122;123; CHECK-FP16-LABEL: testpuxh:124; CHECK-FP16:       // %bb.0: // %entry125; CHECK-FP16-NEXT:    fcvtpu x0, h0126; CHECK-FP16-NEXT:    ret127entry:128  %r = call half @llvm.ceil.f16(half %a) nounwind readnone129  %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)130  ret i64 %i131}132 133define i32 @testpuws(float %a) {134; CHECK-LABEL: testpuws:135; CHECK:       // %bb.0: // %entry136; CHECK-NEXT:    fcvtpu w0, s0137; CHECK-NEXT:    ret138entry:139  %r = call float @ceilf(float %a) nounwind readnone140  %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)141  ret i32 %i142}143 144define i64 @testpuxs(float %a) {145; CHECK-LABEL: testpuxs:146; CHECK:       // %bb.0: // %entry147; CHECK-NEXT:    fcvtpu x0, s0148; CHECK-NEXT:    ret149entry:150  %r = call float @ceilf(float %a) nounwind readnone151  %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)152  ret i64 %i153}154 155define i32 @testpuwd(double %a) {156; CHECK-LABEL: testpuwd:157; CHECK:       // %bb.0: // %entry158; CHECK-NEXT:    fcvtpu w0, d0159; CHECK-NEXT:    ret160entry:161  %r = call double @ceil(double %a) nounwind readnone162  %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)163  ret i32 %i164}165 166define i64 @testpuxd(double %a) {167; CHECK-LABEL: testpuxd:168; CHECK:       // %bb.0: // %entry169; CHECK-NEXT:    fcvtpu x0, d0170; CHECK-NEXT:    ret171entry:172  %r = call double @ceil(double %a) nounwind readnone173  %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)174  ret i64 %i175}176 177; Round towards zero (fcvtzu).178 179define i32 @testzuwh(half %a) {180; CHECK-CVT-LABEL: testzuwh:181; CHECK-CVT:       // %bb.0: // %entry182; CHECK-CVT-NEXT:    fcvt s0, h0183; CHECK-CVT-NEXT:    frintz s0, s0184; CHECK-CVT-NEXT:    fcvt h0, s0185; CHECK-CVT-NEXT:    fcvt s0, h0186; CHECK-CVT-NEXT:    fcvtzu w0, s0187; CHECK-CVT-NEXT:    ret188;189; CHECK-FP16-LABEL: testzuwh:190; CHECK-FP16:       // %bb.0: // %entry191; CHECK-FP16-NEXT:    fcvtzu w0, h0192; CHECK-FP16-NEXT:    ret193entry:194  %r = call half @llvm.trunc.f16(half %a) nounwind readnone195  %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)196  ret i32 %i197}198 199define i64 @testzuxh(half %a) {200; CHECK-CVT-LABEL: testzuxh:201; CHECK-CVT:       // %bb.0: // %entry202; CHECK-CVT-NEXT:    fcvt s0, h0203; CHECK-CVT-NEXT:    frintz s0, s0204; CHECK-CVT-NEXT:    fcvt h0, s0205; CHECK-CVT-NEXT:    fcvt s0, h0206; CHECK-CVT-NEXT:    fcvtzu x0, s0207; CHECK-CVT-NEXT:    ret208;209; CHECK-FP16-LABEL: testzuxh:210; CHECK-FP16:       // %bb.0: // %entry211; CHECK-FP16-NEXT:    fcvtzu x0, h0212; CHECK-FP16-NEXT:    ret213entry:214  %r = call half @llvm.trunc.f16(half %a) nounwind readnone215  %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)216  ret i64 %i217}218 219define i32 @testzuws(float %a) {220; CHECK-LABEL: testzuws:221; CHECK:       // %bb.0: // %entry222; CHECK-NEXT:    fcvtzu w0, s0223; CHECK-NEXT:    ret224entry:225  %r = call float @truncf(float %a) nounwind readnone226  %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)227  ret i32 %i228}229 230define i64 @testzuxs(float %a) {231; CHECK-LABEL: testzuxs:232; CHECK:       // %bb.0: // %entry233; CHECK-NEXT:    fcvtzu x0, s0234; CHECK-NEXT:    ret235entry:236  %r = call float @truncf(float %a) nounwind readnone237  %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)238  ret i64 %i239}240 241define i32 @testzuwd(double %a) {242; CHECK-LABEL: testzuwd:243; CHECK:       // %bb.0: // %entry244; CHECK-NEXT:    fcvtzu w0, d0245; CHECK-NEXT:    ret246entry:247  %r = call double @trunc(double %a) nounwind readnone248  %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)249  ret i32 %i250}251 252define i64 @testzuxd(double %a) {253; CHECK-LABEL: testzuxd:254; CHECK:       // %bb.0: // %entry255; CHECK-NEXT:    fcvtzu x0, d0256; CHECK-NEXT:    ret257entry:258  %r = call double @trunc(double %a) nounwind readnone259  %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)260  ret i64 %i261}262 263; Round to nearest, ties away from zero (fcvtau).264 265define i32 @testauwh(half %a) {266; CHECK-CVT-LABEL: testauwh:267; CHECK-CVT:       // %bb.0: // %entry268; CHECK-CVT-NEXT:    fcvt s0, h0269; CHECK-CVT-NEXT:    frinta s0, s0270; CHECK-CVT-NEXT:    fcvt h0, s0271; CHECK-CVT-NEXT:    fcvt s0, h0272; CHECK-CVT-NEXT:    fcvtzu w0, s0273; CHECK-CVT-NEXT:    ret274;275; CHECK-FP16-LABEL: testauwh:276; CHECK-FP16:       // %bb.0: // %entry277; CHECK-FP16-NEXT:    fcvtau w0, h0278; CHECK-FP16-NEXT:    ret279entry:280  %r = call half @llvm.round.f16(half %a) nounwind readnone281  %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)282  ret i32 %i283}284 285define i64 @testauxh(half %a) {286; CHECK-CVT-LABEL: testauxh:287; CHECK-CVT:       // %bb.0: // %entry288; CHECK-CVT-NEXT:    fcvt s0, h0289; CHECK-CVT-NEXT:    frinta s0, s0290; CHECK-CVT-NEXT:    fcvt h0, s0291; CHECK-CVT-NEXT:    fcvt s0, h0292; CHECK-CVT-NEXT:    fcvtzu x0, s0293; CHECK-CVT-NEXT:    ret294;295; CHECK-FP16-LABEL: testauxh:296; CHECK-FP16:       // %bb.0: // %entry297; CHECK-FP16-NEXT:    fcvtau x0, h0298; CHECK-FP16-NEXT:    ret299entry:300  %r = call half @llvm.round.f16(half %a) nounwind readnone301  %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)302  ret i64 %i303}304 305define i32 @testauws(float %a) {306; CHECK-LABEL: testauws:307; CHECK:       // %bb.0: // %entry308; CHECK-NEXT:    fcvtau w0, s0309; CHECK-NEXT:    ret310entry:311  %r = call float @roundf(float %a) nounwind readnone312  %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)313  ret i32 %i314}315 316define i64 @testauxs(float %a) {317; CHECK-LABEL: testauxs:318; CHECK:       // %bb.0: // %entry319; CHECK-NEXT:    fcvtau x0, s0320; CHECK-NEXT:    ret321entry:322  %r = call float @roundf(float %a) nounwind readnone323  %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)324  ret i64 %i325}326 327define i32 @testauwd(double %a) {328; CHECK-LABEL: testauwd:329; CHECK:       // %bb.0: // %entry330; CHECK-NEXT:    fcvtau w0, d0331; CHECK-NEXT:    ret332entry:333  %r = call double @round(double %a) nounwind readnone334  %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)335  ret i32 %i336}337 338define i64 @testauxd(double %a) {339; CHECK-LABEL: testauxd:340; CHECK:       // %bb.0: // %entry341; CHECK-NEXT:    fcvtau x0, d0342; CHECK-NEXT:    ret343entry:344  %r = call double @round(double %a) nounwind readnone345  %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)346  ret i64 %i347}348 349declare i32 @llvm.fptoui.sat.i32.f16 (half)350declare i64 @llvm.fptoui.sat.i64.f16 (half)351declare i32 @llvm.fptoui.sat.i32.f32 (float)352declare i64 @llvm.fptoui.sat.i64.f32 (float)353declare i32 @llvm.fptoui.sat.i32.f64 (double)354declare i64 @llvm.fptoui.sat.i64.f64 (double)355 356declare half @llvm.floor.f16(half) nounwind readnone357declare half @llvm.ceil.f16(half) nounwind readnone358declare half @llvm.trunc.f16(half) nounwind readnone359declare half @llvm.round.f16(half) nounwind readnone360declare float @floorf(float) nounwind readnone361declare float @ceilf(float) nounwind readnone362declare float @truncf(float) nounwind readnone363declare float @roundf(float) nounwind readnone364declare double @floor(double) nounwind readnone365declare double @ceil(double) nounwind readnone366declare double @trunc(double) nounwind readnone367declare double @round(double) nounwind readnone368