Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc -mcpu=a2 < %s | FileCheck %s
      2 target datalayout = "E-m:e-i64:64-n32:64"
      3 target triple = "powerpc64-unknown-linux-gnu"
      4 
      5 ; Function Attrs: nounwind readonly
      6 define double @test1(i64* nocapture readonly %x) #0 {
      7 entry:
      8   %0 = load i64, i64* %x, align 8
      9   %conv = sitofp i64 %0 to double
     10   ret double %conv
     11 
     12 ; CHECK-LABEL: @test1
     13 ; CHECK: lfd [[REG1:[0-9]+]], 0(3)
     14 ; CHECK: fcfid 1, [[REG1]]
     15 ; CHECK: blr
     16 }
     17 
     18 ; Function Attrs: nounwind readonly
     19 define double @test2(i32* nocapture readonly %x) #0 {
     20 entry:
     21   %0 = load i32, i32* %x, align 4
     22   %conv = sitofp i32 %0 to double
     23   ret double %conv
     24 
     25 ; CHECK-LABEL: @test2
     26 ; CHECK: lfiwax [[REG1:[0-9]+]], 0, 3
     27 ; CHECK: fcfid 1, [[REG1]]
     28 ; CHECK: blr
     29 }
     30 
     31 ; Function Attrs: nounwind readnone
     32 define float @foo(float %X) #0 {
     33 entry:
     34   %conv = fptosi float %X to i32
     35   %conv1 = sitofp i32 %conv to float
     36   ret float %conv1
     37 
     38 ; CHECK-LABEL: @foo
     39 ; CHECK-DAG: fctiwz [[REG2:[0-9]+]], 1
     40 ; CHECK-DAG: addi [[REG1:[0-9]+]], 1,
     41 ; CHECK: stfiwx [[REG2]], 0, [[REG1]]
     42 ; CHECK: lfiwax [[REG3:[0-9]+]], 0, [[REG1]]
     43 ; CHECK: fcfids 1, [[REG3]]
     44 ; CHECK: blr
     45 }
     46 
     47 ; Function Attrs: nounwind readnone
     48 define double @food(double %X) #0 {
     49 entry:
     50   %conv = fptosi double %X to i32
     51   %conv1 = sitofp i32 %conv to double
     52   ret double %conv1
     53 
     54 ; CHECK-LABEL: @food
     55 ; CHECK-DAG: fctiwz [[REG2:[0-9]+]], 1
     56 ; CHECK-DAG: addi [[REG1:[0-9]+]], 1,
     57 ; CHECK: stfiwx [[REG2]], 0, [[REG1]]
     58 ; CHECK: lfiwax [[REG3:[0-9]+]], 0, [[REG1]]
     59 ; CHECK: fcfid 1, [[REG3]]
     60 ; CHECK: blr
     61 }
     62 
     63 ; Function Attrs: nounwind readnone
     64 define float @foou(float %X) #0 {
     65 entry:
     66   %conv = fptoui float %X to i32
     67   %conv1 = uitofp i32 %conv to float
     68   ret float %conv1
     69 
     70 ; CHECK-LABEL: @foou
     71 ; CHECK-DAG: fctiwuz [[REG2:[0-9]+]], 1
     72 ; CHECK-DAG: addi [[REG1:[0-9]+]], 1,
     73 ; CHECK: stfiwx [[REG2]], 0, [[REG1]]
     74 ; CHECK: lfiwzx [[REG3:[0-9]+]], 0, [[REG1]]
     75 ; CHECK: fcfidus 1, [[REG3]]
     76 ; CHECK: blr
     77 }
     78 
     79 ; Function Attrs: nounwind readnone
     80 define double @fooud(double %X) #0 {
     81 entry:
     82   %conv = fptoui double %X to i32
     83   %conv1 = uitofp i32 %conv to double
     84   ret double %conv1
     85 
     86 ; CHECK-LABEL: @fooud
     87 ; CHECK-DAG: fctiwuz [[REG2:[0-9]+]], 1
     88 ; CHECK-DAG: addi [[REG1:[0-9]+]], 1,
     89 ; CHECK: stfiwx [[REG2]], 0, [[REG1]]
     90 ; CHECK: lfiwzx [[REG3:[0-9]+]], 0, [[REG1]]
     91 ; CHECK: fcfidu 1, [[REG3]]
     92 ; CHECK: blr
     93 }
     94 
     95 attributes #0 = { nounwind readonly }
     96 
     97