Home | History | Annotate | Download | only in AArch64
      1 // RUN: llvm-mc -triple=aarch64-none-linux-gnu < %s | FileCheck %s
      2 // RUN: not llvm-mc -mattr=+no-neg-immediates -triple=aarch64-none-linux-gnu < %s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-NEG-IMM
      3 
      4         add w0, w2, #4096
      5         sub w0, w2, #4096
      6 // CHECK: add w0, w2, #1, lsl #12
      7 // CHECK: sub w0, w2, #1, lsl #12
      8 
      9         add w0, w2, #-4096
     10         sub w0, w2, #-4096
     11 // CHECK: sub w0, w2, #1, lsl #12
     12 // CHECK: add w0, w2, #1, lsl #12
     13 
     14 // CHECK: sub w0, w2, #2, lsl #12
     15 // CHECK: sub w0, w2, #2, lsl #12
     16 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     17         sub w0, w2, #2, lsl 12
     18         add w0, w2, #-2, lsl 12
     19 // CHECK: sub x1, x3, #2, lsl #12
     20 // CHECK: sub x1, x3, #2, lsl #12
     21 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     22         sub x1, x3, #2, lsl 12
     23         add x1, x3, #-2, lsl 12
     24 // CHECK: sub x1, x3, #4
     25 // CHECK: sub x1, x3, #4
     26 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     27         sub x1, x3, #4
     28         add x1, x3, #-4
     29 // CHECK: sub x1, x3, #4095
     30 // CHECK: sub x1, x3, #4095
     31 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     32         sub x1, x3, #4095, lsl 0
     33         add x1, x3, #-4095, lsl 0
     34 // CHECK: sub x3, x4, #0
     35         sub x3, x4, #0
     36 
     37 // CHECK: add w0, w2, #2, lsl #12
     38 // CHECK: add w0, w2, #2, lsl #12
     39 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     40         add w0, w2, #2, lsl 12
     41         sub w0, w2, #-2, lsl 12
     42 // CHECK: add x1, x3, #2, lsl #12
     43 // CHECK: add x1, x3, #2, lsl #12
     44 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     45         add x1, x3, #2, lsl 12
     46         sub x1, x3, #-2, lsl 12
     47 // CHECK: add x1, x3, #4
     48 // CHECK: add x1, x3, #4
     49 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     50         add x1, x3, #4
     51         sub x1, x3, #-4
     52 // CHECK: add x1, x3, #4095
     53 // CHECK: add x1, x3, #4095
     54 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     55         add x1, x3, #4095, lsl 0
     56         sub x1, x3, #-4095, lsl 0
     57 // CHECK: add x2, x5, #0
     58         add x2, x5, #0
     59 
     60 // CHECK: subs w0, w2, #2, lsl #12
     61 // CHECK: subs w0, w2, #2, lsl #12
     62 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     63         subs w0, w2, #2, lsl 12
     64         adds w0, w2, #-2, lsl 12
     65 // CHECK: subs x1, x3, #2, lsl #12
     66 // CHECK: subs x1, x3, #2, lsl #12
     67 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     68         subs x1, x3, #2, lsl 12
     69         adds x1, x3, #-2, lsl 12
     70 // CHECK: subs x1, x3, #4
     71 // CHECK: subs x1, x3, #4
     72 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     73         subs x1, x3, #4
     74         adds x1, x3, #-4
     75 // CHECK: subs x1, x3, #4095
     76 // CHECK: subs x1, x3, #4095
     77 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     78         subs x1, x3, #4095, lsl 0
     79         adds x1, x3, #-4095, lsl 0
     80 // CHECK: subs x3, x4, #0
     81         subs x3, x4, #0
     82 
     83 // CHECK: adds w0, w2, #2, lsl #12
     84 // CHECK: adds w0, w2, #2, lsl #12
     85 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     86         adds w0, w2, #2, lsl 12
     87         subs w0, w2, #-2, lsl 12
     88 // CHECK: adds x1, x3, #2, lsl #12
     89 // CHECK: adds x1, x3, #2, lsl #12
     90 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     91         adds x1, x3, #2, lsl 12
     92         subs x1, x3, #-2, lsl 12
     93 // CHECK: adds x1, x3, #4
     94 // CHECK: adds x1, x3, #4
     95 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
     96         adds x1, x3, #4
     97         subs x1, x3, #-4
     98 // CHECK: adds x1, x3, #4095
     99 // CHECK: adds x1, x3, #4095
    100 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
    101         adds x1, x3, #4095, lsl 0
    102         subs x1, x3, #-4095, lsl 0
    103 // CHECK: adds x2, x5, #0
    104         adds x2, x5, #0
    105 
    106 // CHECK: {{adds xzr,|cmn}} x5, #5
    107 // CHECK: {{adds xzr,|cmn}} x5, #5
    108 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
    109         cmn x5, #5
    110         cmp x5, #-5
    111 // CHECK: {{subs xzr,|cmp}} x6, #4095
    112 // CHECK: {{subs xzr,|cmp}} x6, #4095
    113 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
    114         cmp x6, #4095
    115         cmn x6, #-4095
    116 // CHECK: {{adds wzr,|cmn}} w7, #5
    117 // CHECK: {{adds wzr,|cmn}} w7, #5
    118 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
    119         cmn w7, #5
    120         cmp w7, #-5
    121 // CHECK: {{subs wzr,|cmp}} w8, #4095
    122 // CHECK: {{subs wzr,|cmp}} w8, #4095
    123 // CHECK-NO-NEG-IMM: instruction requires: NegativeImmediates
    124         cmp w8, #4095
    125         cmn w8, #-4095
    126