Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -march=x86-64 -verify-machineinstrs | FileCheck %s
      2 ; RUN: llc < %s -march=x86-64 -mattr=slow-incdec -verify-machineinstrs | FileCheck %s --check-prefix SLOW_INC
      3 
      4 ; rdar://7103704
      5 
      6 define void @sub1(i32* nocapture %p, i32 %v) nounwind ssp {
      7 entry:
      8 ; CHECK-LABEL: sub1:
      9 ; CHECK: subl
     10   %0 = atomicrmw sub i32* %p, i32 %v monotonic
     11   ret void
     12 }
     13 
     14 define void @inc4(i64* nocapture %p) nounwind ssp {
     15 entry:
     16 ; CHECK-LABEL: inc4:
     17 ; CHECK: incq
     18 ; SLOW_INC-LABEL: inc4:
     19 ; SLOW_INC-NOT: incq
     20   %0 = atomicrmw add i64* %p, i64 1 monotonic
     21   ret void
     22 }
     23 
     24 define void @add8(i64* nocapture %p) nounwind ssp {
     25 entry:
     26 ; CHECK-LABEL: add8:
     27 ; CHECK: addq $2
     28   %0 = atomicrmw add i64* %p, i64 2 monotonic
     29   ret void
     30 }
     31 
     32 define void @add4(i64* nocapture %p, i32 %v) nounwind ssp {
     33 entry:
     34 ; CHECK-LABEL: add4:
     35 ; CHECK: addq
     36   %0 = sext i32 %v to i64		; <i64> [#uses=1]
     37   %1 = atomicrmw add i64* %p, i64 %0 monotonic
     38   ret void
     39 }
     40 
     41 define void @inc3(i8* nocapture %p) nounwind ssp {
     42 entry:
     43 ; CHECK-LABEL: inc3:
     44 ; CHECK: incb
     45 ; SLOW_INC-LABEL: inc3:
     46 ; SLOW_INC-NOT: incb
     47   %0 = atomicrmw add i8* %p, i8 1 monotonic
     48   ret void
     49 }
     50 
     51 define void @add7(i8* nocapture %p) nounwind ssp {
     52 entry:
     53 ; CHECK-LABEL: add7:
     54 ; CHECK: addb $2
     55   %0 = atomicrmw add i8* %p, i8 2 monotonic
     56   ret void
     57 }
     58 
     59 define void @add3(i8* nocapture %p, i32 %v) nounwind ssp {
     60 entry:
     61 ; CHECK-LABEL: add3:
     62 ; CHECK: addb
     63   %0 = trunc i32 %v to i8		; <i8> [#uses=1]
     64   %1 = atomicrmw add i8* %p, i8 %0 monotonic
     65   ret void
     66 }
     67 
     68 define void @inc2(i16* nocapture %p) nounwind ssp {
     69 entry:
     70 ; CHECK-LABEL: inc2:
     71 ; CHECK: incw
     72 ; SLOW_INC-LABEL: inc2:
     73 ; SLOW_INC-NOT: incw
     74   %0 = atomicrmw add i16* %p, i16 1 monotonic
     75   ret void
     76 }
     77 
     78 define void @add6(i16* nocapture %p) nounwind ssp {
     79 entry:
     80 ; CHECK-LABEL: add6:
     81 ; CHECK: addw $2
     82   %0 = atomicrmw add i16* %p, i16 2 monotonic
     83   ret void
     84 }
     85 
     86 define void @add2(i16* nocapture %p, i32 %v) nounwind ssp {
     87 entry:
     88 ; CHECK-LABEL: add2:
     89 ; CHECK: addw
     90 	%0 = trunc i32 %v to i16		; <i16> [#uses=1]
     91   %1 = atomicrmw add i16* %p, i16 %0 monotonic
     92   ret void
     93 }
     94 
     95 define void @inc1(i32* nocapture %p) nounwind ssp {
     96 entry:
     97 ; CHECK-LABEL: inc1:
     98 ; CHECK: incl
     99 ; SLOW_INC-LABEL: inc1:
    100 ; SLOW_INC-NOT: incl
    101   %0 = atomicrmw add i32* %p, i32 1 monotonic
    102   ret void
    103 }
    104 
    105 define void @add5(i32* nocapture %p) nounwind ssp {
    106 entry:
    107 ; CHECK-LABEL: add5:
    108 ; CHECK: addl $2
    109   %0 = atomicrmw add i32* %p, i32 2 monotonic
    110   ret void
    111 }
    112 
    113 define void @add1(i32* nocapture %p, i32 %v) nounwind ssp {
    114 entry:
    115 ; CHECK-LABEL: add1:
    116 ; CHECK: addl
    117   %0 = atomicrmw add i32* %p, i32 %v monotonic
    118   ret void
    119 }
    120 
    121 define void @dec4(i64* nocapture %p) nounwind ssp {
    122 entry:
    123 ; CHECK-LABEL: dec4:
    124 ; CHECK: decq
    125 ; SLOW_INC-LABEL: dec4:
    126 ; SLOW_INC-NOT: decq
    127   %0 = atomicrmw sub i64* %p, i64 1 monotonic
    128   ret void
    129 }
    130 
    131 define void @sub8(i64* nocapture %p) nounwind ssp {
    132 entry:
    133 ; CHECK-LABEL: sub8:
    134 ; CHECK: subq $2
    135   %0 = atomicrmw sub i64* %p, i64 2 monotonic
    136   ret void
    137 }
    138 
    139 define void @sub4(i64* nocapture %p, i32 %v) nounwind ssp {
    140 entry:
    141 ; CHECK-LABEL: sub4:
    142 ; CHECK: subq
    143 	%0 = sext i32 %v to i64		; <i64> [#uses=1]
    144   %1 = atomicrmw sub i64* %p, i64 %0 monotonic
    145   ret void
    146 }
    147 
    148 define void @dec3(i8* nocapture %p) nounwind ssp {
    149 entry:
    150 ; CHECK-LABEL: dec3:
    151 ; CHECK: decb
    152 ; SLOW_INC-LABEL: dec3:
    153 ; SLOW_INC-NOT: decb
    154   %0 = atomicrmw sub i8* %p, i8 1 monotonic
    155   ret void
    156 }
    157 
    158 define void @sub7(i8* nocapture %p) nounwind ssp {
    159 entry:
    160 ; CHECK-LABEL: sub7:
    161 ; CHECK: subb $2
    162   %0 = atomicrmw sub i8* %p, i8 2 monotonic
    163   ret void
    164 }
    165 
    166 define void @sub3(i8* nocapture %p, i32 %v) nounwind ssp {
    167 entry:
    168 ; CHECK-LABEL: sub3:
    169 ; CHECK: subb
    170 	%0 = trunc i32 %v to i8		; <i8> [#uses=1]
    171   %1 = atomicrmw sub i8* %p, i8 %0 monotonic
    172   ret void
    173 }
    174 
    175 define void @dec2(i16* nocapture %p) nounwind ssp {
    176 entry:
    177 ; CHECK-LABEL: dec2:
    178 ; CHECK: decw
    179 ; SLOW_INC-LABEL: dec2:
    180 ; SLOW_INC-NOT: decw
    181   %0 = atomicrmw sub i16* %p, i16 1 monotonic
    182   ret void
    183 }
    184 
    185 define void @sub6(i16* nocapture %p) nounwind ssp {
    186 entry:
    187 ; CHECK-LABEL: sub6:
    188 ; CHECK: subw $2
    189   %0 = atomicrmw sub i16* %p, i16 2 monotonic
    190   ret void
    191 }
    192 
    193 define void @sub2(i16* nocapture %p, i32 %v) nounwind ssp {
    194 entry:
    195 ; CHECK-LABEL: sub2:
    196 ; CHECK-NOT: negl
    197 ; CHECK: subw
    198 	%0 = trunc i32 %v to i16		; <i16> [#uses=1]
    199   %1 = atomicrmw sub i16* %p, i16 %0 monotonic
    200   ret void
    201 }
    202 
    203 define void @dec1(i32* nocapture %p) nounwind ssp {
    204 entry:
    205 ; CHECK-LABEL: dec1:
    206 ; CHECK: decl
    207 ; SLOW_INC-LABEL: dec1:
    208 ; SLOW_INC-NOT: decl
    209   %0 = atomicrmw sub i32* %p, i32 1 monotonic
    210   ret void
    211 }
    212 
    213 define void @sub5(i32* nocapture %p) nounwind ssp {
    214 entry:
    215 ; CHECK-LABEL: sub5:
    216 ; CHECK: subl $2
    217   %0 = atomicrmw sub i32* %p, i32 2 monotonic
    218   ret void
    219 }
    220