Home | History | Annotate | Download | only in AMDGPU
      1 ;RUN: llc < %s -march=amdgcn -mcpu=SI -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s
      2 ;RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s
      3 
      4 ; XXX: Merge this into setcc, once R600 supports 64-bit operations
      5 
      6 ;;;==========================================================================;;;
      7 ;; Double comparisons
      8 ;;;==========================================================================;;;
      9 
     10 ; FUNC-LABEL: {{^}}f64_oeq:
     11 ; SI: v_cmp_eq_f64
     12 define void @f64_oeq(i32 addrspace(1)* %out, double %a, double %b) {
     13 entry:
     14   %0 = fcmp oeq double %a, %b
     15   %1 = sext i1 %0 to i32
     16   store i32 %1, i32 addrspace(1)* %out
     17   ret void
     18 }
     19 
     20 ; FUNC-LABEL: {{^}}f64_ogt:
     21 ; SI: v_cmp_gt_f64
     22 define void @f64_ogt(i32 addrspace(1)* %out, double %a, double %b) {
     23 entry:
     24   %0 = fcmp ogt double %a, %b
     25   %1 = sext i1 %0 to i32
     26   store i32 %1, i32 addrspace(1)* %out
     27   ret void
     28 }
     29 
     30 ; FUNC-LABEL: {{^}}f64_oge:
     31 ; SI: v_cmp_ge_f64
     32 define void @f64_oge(i32 addrspace(1)* %out, double %a, double %b) {
     33 entry:
     34   %0 = fcmp oge double %a, %b
     35   %1 = sext i1 %0 to i32
     36   store i32 %1, i32 addrspace(1)* %out
     37   ret void
     38 }
     39 
     40 ; FUNC-LABEL: {{^}}f64_olt:
     41 ; SI: v_cmp_lt_f64
     42 define void @f64_olt(i32 addrspace(1)* %out, double %a, double %b) {
     43 entry:
     44   %0 = fcmp olt double %a, %b
     45   %1 = sext i1 %0 to i32
     46   store i32 %1, i32 addrspace(1)* %out
     47   ret void
     48 }
     49 
     50 ; FUNC-LABEL: {{^}}f64_ole:
     51 ; SI: v_cmp_le_f64
     52 define void @f64_ole(i32 addrspace(1)* %out, double %a, double %b) {
     53 entry:
     54   %0 = fcmp ole double %a, %b
     55   %1 = sext i1 %0 to i32
     56   store i32 %1, i32 addrspace(1)* %out
     57   ret void
     58 }
     59 
     60 ; FUNC-LABEL: {{^}}f64_one:
     61 ; SI: v_cmp_lg_f64_e32 vcc
     62 ; SI-NEXT: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
     63 define void @f64_one(i32 addrspace(1)* %out, double %a, double %b) {
     64 entry:
     65   %0 = fcmp one double %a, %b
     66   %1 = sext i1 %0 to i32
     67   store i32 %1, i32 addrspace(1)* %out
     68   ret void
     69 }
     70 
     71 ; FUNC-LABEL: {{^}}f64_ord:
     72 ; SI: v_cmp_o_f64
     73 define void @f64_ord(i32 addrspace(1)* %out, double %a, double %b) {
     74 entry:
     75   %0 = fcmp ord double %a, %b
     76   %1 = sext i1 %0 to i32
     77   store i32 %1, i32 addrspace(1)* %out
     78   ret void
     79 }
     80 
     81 ; FUNC-LABEL: {{^}}f64_ueq:
     82 ; SI: v_cmp_nlg_f64_e32 vcc
     83 ; SI-NEXT: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
     84 define void @f64_ueq(i32 addrspace(1)* %out, double %a, double %b) {
     85 entry:
     86   %0 = fcmp ueq double %a, %b
     87   %1 = sext i1 %0 to i32
     88   store i32 %1, i32 addrspace(1)* %out
     89   ret void
     90 }
     91 
     92 ; FUNC-LABEL: {{^}}f64_ugt:
     93 
     94 ; SI: v_cmp_nle_f64_e32 vcc
     95 ; SI-NEXT: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
     96 define void @f64_ugt(i32 addrspace(1)* %out, double %a, double %b) {
     97 entry:
     98   %0 = fcmp ugt double %a, %b
     99   %1 = sext i1 %0 to i32
    100   store i32 %1, i32 addrspace(1)* %out
    101   ret void
    102 }
    103 
    104 ; FUNC-LABEL: {{^}}f64_uge:
    105 ; SI: v_cmp_nlt_f64_e32 vcc
    106 ; SI-NEXT: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
    107 define void @f64_uge(i32 addrspace(1)* %out, double %a, double %b) {
    108 entry:
    109   %0 = fcmp uge double %a, %b
    110   %1 = sext i1 %0 to i32
    111   store i32 %1, i32 addrspace(1)* %out
    112   ret void
    113 }
    114 
    115 ; FUNC-LABEL: {{^}}f64_ult:
    116 ; SI: v_cmp_nge_f64_e32 vcc
    117 ; SI-NEXT: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
    118 define void @f64_ult(i32 addrspace(1)* %out, double %a, double %b) {
    119 entry:
    120   %0 = fcmp ult double %a, %b
    121   %1 = sext i1 %0 to i32
    122   store i32 %1, i32 addrspace(1)* %out
    123   ret void
    124 }
    125 
    126 ; FUNC-LABEL: {{^}}f64_ule:
    127 ; SI: v_cmp_ngt_f64_e32 vcc
    128 ; SI-NEXT: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
    129 define void @f64_ule(i32 addrspace(1)* %out, double %a, double %b) {
    130 entry:
    131   %0 = fcmp ule double %a, %b
    132   %1 = sext i1 %0 to i32
    133   store i32 %1, i32 addrspace(1)* %out
    134   ret void
    135 }
    136 
    137 ; FUNC-LABEL: {{^}}f64_une:
    138 ; SI: v_cmp_neq_f64
    139 define void @f64_une(i32 addrspace(1)* %out, double %a, double %b) {
    140 entry:
    141   %0 = fcmp une double %a, %b
    142   %1 = sext i1 %0 to i32
    143   store i32 %1, i32 addrspace(1)* %out
    144   ret void
    145 }
    146 
    147 ; FUNC-LABEL: {{^}}f64_uno:
    148 ; SI: v_cmp_u_f64
    149 define void @f64_uno(i32 addrspace(1)* %out, double %a, double %b) {
    150 entry:
    151   %0 = fcmp uno double %a, %b
    152   %1 = sext i1 %0 to i32
    153   store i32 %1, i32 addrspace(1)* %out
    154   ret void
    155 }
    156 
    157 ;;;==========================================================================;;;
    158 ;; 64-bit integer comparisons
    159 ;;;==========================================================================;;;
    160 
    161 ; FUNC-LABEL: {{^}}i64_eq:
    162 ; SI: v_cmp_eq_i64
    163 define void @i64_eq(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    164 entry:
    165   %0 = icmp eq i64 %a, %b
    166   %1 = sext i1 %0 to i32
    167   store i32 %1, i32 addrspace(1)* %out
    168   ret void
    169 }
    170 
    171 ; FUNC-LABEL: {{^}}i64_ne:
    172 ; SI: v_cmp_ne_i64
    173 define void @i64_ne(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    174 entry:
    175   %0 = icmp ne i64 %a, %b
    176   %1 = sext i1 %0 to i32
    177   store i32 %1, i32 addrspace(1)* %out
    178   ret void
    179 }
    180 
    181 ; FUNC-LABEL: {{^}}i64_ugt:
    182 ; SI: v_cmp_gt_u64
    183 define void @i64_ugt(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    184 entry:
    185   %0 = icmp ugt i64 %a, %b
    186   %1 = sext i1 %0 to i32
    187   store i32 %1, i32 addrspace(1)* %out
    188   ret void
    189 }
    190 
    191 ; FUNC-LABEL: {{^}}i64_uge:
    192 ; SI: v_cmp_ge_u64
    193 define void @i64_uge(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    194 entry:
    195   %0 = icmp uge i64 %a, %b
    196   %1 = sext i1 %0 to i32
    197   store i32 %1, i32 addrspace(1)* %out
    198   ret void
    199 }
    200 
    201 ; FUNC-LABEL: {{^}}i64_ult:
    202 ; SI: v_cmp_lt_u64
    203 define void @i64_ult(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    204 entry:
    205   %0 = icmp ult i64 %a, %b
    206   %1 = sext i1 %0 to i32
    207   store i32 %1, i32 addrspace(1)* %out
    208   ret void
    209 }
    210 
    211 ; FUNC-LABEL: {{^}}i64_ule:
    212 ; SI: v_cmp_le_u64
    213 define void @i64_ule(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    214 entry:
    215   %0 = icmp ule i64 %a, %b
    216   %1 = sext i1 %0 to i32
    217   store i32 %1, i32 addrspace(1)* %out
    218   ret void
    219 }
    220 
    221 ; FUNC-LABEL: {{^}}i64_sgt:
    222 ; SI: v_cmp_gt_i64
    223 define void @i64_sgt(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    224 entry:
    225   %0 = icmp sgt i64 %a, %b
    226   %1 = sext i1 %0 to i32
    227   store i32 %1, i32 addrspace(1)* %out
    228   ret void
    229 }
    230 
    231 ; FUNC-LABEL: {{^}}i64_sge:
    232 ; SI: v_cmp_ge_i64
    233 define void @i64_sge(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    234 entry:
    235   %0 = icmp sge i64 %a, %b
    236   %1 = sext i1 %0 to i32
    237   store i32 %1, i32 addrspace(1)* %out
    238   ret void
    239 }
    240 
    241 ; FUNC-LABEL: {{^}}i64_slt:
    242 ; SI: v_cmp_lt_i64
    243 define void @i64_slt(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    244 entry:
    245   %0 = icmp slt i64 %a, %b
    246   %1 = sext i1 %0 to i32
    247   store i32 %1, i32 addrspace(1)* %out
    248   ret void
    249 }
    250 
    251 ; FUNC-LABEL: {{^}}i64_sle:
    252 ; SI: v_cmp_le_i64
    253 define void @i64_sle(i32 addrspace(1)* %out, i64 %a, i64 %b) {
    254 entry:
    255   %0 = icmp sle i64 %a, %b
    256   %1 = sext i1 %0 to i32
    257   store i32 %1, i32 addrspace(1)* %out
    258   ret void
    259 }
    260