Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s
      2 
      3 ; PR20778
      4 ; Check that the legalizer doesn't crash when scalarizing FP conversion
      5 ; instructions' operands.  The operands are all illegal on AArch64,
      6 ; ensuring they are legalized.  The results are all legal.
      7 
      8 define <1 x double> @test_sitofp(<1 x i1> %in) {
      9 ; CHECK-LABEL: test_sitofp:
     10 ; CHECK:       sbfx  [[GPR:w[0-9]+]], w0, #0, #1
     11 ; CHECK-NEXT:  scvtf d0, [[GPR]]
     12 ; CHECK-NEXT:  ret
     13 entry:
     14   %0 = sitofp <1 x i1> %in to <1 x double>
     15   ret <1 x double> %0
     16 }
     17 
     18 define <1 x double> @test_uitofp(<1 x i1> %in) {
     19 ; CHECK-LABEL: test_uitofp:
     20 ; CHECK:       and   [[GPR:w[0-9]+]], w0, #0x1
     21 ; CHECK-NEXT:  ucvtf d0, [[GPR]]
     22 ; CHECK-NEXT:  ret
     23 entry:
     24   %0 = uitofp <1 x i1> %in to <1 x double>
     25   ret <1 x double> %0
     26 }
     27 
     28 define <1 x i64> @test_fptosi(<1 x fp128> %in) {
     29 ; CHECK-LABEL: test_fptosi:
     30 ; CHECK:       bl    ___fixtfdi
     31 ; CHECK-NEXT:  fmov  d0, x0
     32 entry:
     33   %0 = fptosi <1 x fp128> %in to <1 x i64>
     34   ret <1 x i64> %0
     35 }
     36 
     37 define <1 x i64> @test_fptoui(<1 x fp128> %in) {
     38 ; CHECK-LABEL: test_fptoui:
     39 ; CHECK:       bl    ___fixunstfdi
     40 ; CHECK-NEXT:  fmov  d0, x0
     41 entry:
     42   %0 = fptoui <1 x fp128> %in to <1 x i64>
     43   ret <1 x i64> %0
     44 }
     45