Home | History | Annotate | Download | only in Driver
      1 // Test that different values of -mfpu pick correct ARM FPU target-feature(s).
      2 
      3 // RUN: %clang -target arm-linux-eabi %s -### -o %t.o 2>&1 \
      4 // RUN:   | FileCheck --check-prefix=CHECK-DEFAULT %s
      5 // CHECK-DEFAULT-NOT: "-target-feature" "+vfp2"
      6 // CHECK-DEFAULT-NOT: "-target-feature" "+vfp3"
      7 // CHECK-DEFAULT-NOT: "-target-feature" "+d16"
      8 // CHECK-DEFAULT-NOT: "-target-feature" "+neon"
      9 
     10 // RUN: %clang -target arm-linux-eabi -mfpu=fpa %s -### -o %t.o 2>&1 \
     11 // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
     12 // RUN: %clang -target arm-linux-eabi -mfpu=fpe2 %s -### -o %t.o 2>&1 \
     13 // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
     14 // RUN: %clang -target arm-linux-eabi -mfpu=fpe3 %s -### -o %t.o 2>&1 \
     15 // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
     16 // RUN: %clang -target arm-linux-eabi -mfpu=maverick %s -### -o %t.o 2>&1 \
     17 // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
     18 // CHECK-FPA: error: {{.*}} does not support '-mfpu={{fpa|fpe|fpe2|fpe3|maverick}}'
     19 
     20 // RUN: %clang -target arm-linux-eabi -mfpu=vfp %s -### -o %t.o 2>&1 \
     21 // RUN:   | FileCheck --check-prefix=CHECK-VFP %s
     22 // CHECK-VFP: "-target-feature" "+vfp2"
     23 // CHECK-VFP: "-target-feature" "-vfp3"
     24 // CHECK-VFP: "-target-feature" "-vfp4"
     25 // CHECK-VFP: "-target-feature" "-fp-armv8"
     26 // CHECK-VFP: "-target-feature" "-neon"
     27 
     28 // RUN: %clang -target arm-linux-eabi -mfpu=vfp3 %s -### -o %t.o 2>&1 \
     29 // RUN:   | FileCheck --check-prefix=CHECK-VFP3 %s
     30 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3 %s -### -o %t.o 2>&1 \
     31 // RUN:   | FileCheck --check-prefix=CHECK-VFP3 %s
     32 // CHECK-VFP3: "-target-feature" "+vfp3"
     33 // CHECK-VFP3: "-target-feature" "-vfp4"
     34 // CHECK-VFP3: "-target-feature" "-fp-armv8"
     35 // CHECK-VFP3: "-target-feature" "-neon"
     36 
     37 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-fp16 %s -### -o %t.o 2>&1 \
     38 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-FP16 %s
     39 // CHECK-VFP3-FP16: "-target-feature" "-fp-only-sp"
     40 // CHECK-VFP3-FP16: "-target-feature" "-d16"
     41 // CHECK-VFP3-FP16: "-target-feature" "+vfp3"
     42 // CHECK-VFP3-FP16: "-target-feature" "+fp16"
     43 // CHECK-VFP3-FP16: "-target-feature" "-vfp4"
     44 // CHECK-VFP3-FP16: "-target-feature" "-fp-armv8"
     45 // CHECK-VFP3-FP16: "-target-feature" "-neon"
     46 // CHECK-VFP3-FP16: "-target-feature" "-crypto"
     47 
     48 // RUN: %clang -target arm-linux-eabi -mfpu=vfp3-d16 %s -### -o %t.o 2>&1 \
     49 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16 %s
     50 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \
     51 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16 %s
     52 // CHECK-VFP3-D16: "-target-feature" "-fp-only-sp"
     53 // CHECK-VFP3-D16: "-target-feature" "+d16"
     54 // CHECK-VFP3-D16: "-target-feature" "+vfp3"
     55 // CHECK-VFP3-D16: "-target-feature" "-vfp4"
     56 // CHECK-VFP3-D16: "-target-feature" "-fp-armv8"
     57 // CHECK-VFP3-D16: "-target-feature" "-neon"
     58 
     59 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16-fp16 %s -### -o %t.o 2>&1 \
     60 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16-FP16 %s
     61 // CHECK-VFP3-D16-FP16: "-target-feature" "-fp-only-sp"
     62 // CHECK-VFP3-D16-FP16: "-target-feature" "+d16"
     63 // CHECK-VFP3-D16-FP16: "-target-feature" "+vfp3"
     64 // CHECK-VFP3-D16-FP16: "-target-feature" "+fp16"
     65 // CHECK-VFP3-D16-FP16: "-target-feature" "-vfp4"
     66 // CHECK-VFP3-D16-FP16: "-target-feature" "-fp-armv8"
     67 // CHECK-VFP3-D16-FP16: "-target-feature" "-neon"
     68 // CHECK-VFP3-D16-FP16: "-target-feature" "-crypto"
     69 
     70 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd %s -### -o %t.o 2>&1 \
     71 // RUN:   | FileCheck --check-prefix=CHECK-VFP3XD %s
     72 // CHECK-VFP3XD: "-target-feature" "+fp-only-sp"
     73 // CHECK-VFP3XD: "-target-feature" "+d16"
     74 // CHECK-VFP3XD: "-target-feature" "+vfp3"
     75 // CHECK-VFP3XD: "-target-feature" "-fp16"
     76 // CHECK-VFP3XD: "-target-feature" "-vfp4"
     77 // CHECK-VFP3XD: "-target-feature" "-fp-armv8"
     78 // CHECK-VFP3XD: "-target-feature" "-neon"
     79 // CHECK-VFP3XD: "-target-feature" "-crypto"
     80 
     81 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd-fp16 %s -### -o %t.o 2>&1 \
     82 // RUN:   | FileCheck --check-prefix=CHECK-VFP3XD-FP16 %s
     83 // CHECK-VFP3XD-FP16: "-target-feature" "+fp-only-sp"
     84 // CHECK-VFP3XD-FP16: "-target-feature" "+d16"
     85 // CHECK-VFP3XD-FP16: "-target-feature" "+vfp3"
     86 // CHECK-VFP3XD-FP16: "-target-feature" "+fp16"
     87 // CHECK-VFP3XD-FP16: "-target-feature" "-vfp4"
     88 // CHECK-VFP3XD-FP16: "-target-feature" "-fp-armv8"
     89 // CHECK-VFP3XD-FP16: "-target-feature" "-neon"
     90 // CHECK-VFP3XD-FP16: "-target-feature" "-crypto"
     91 
     92 // RUN: %clang -target arm-linux-eabi -mfpu=vfp4 %s -### -o %t.o 2>&1 \
     93 // RUN:   | FileCheck --check-prefix=CHECK-VFP4 %s
     94 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4 %s -### -o %t.o 2>&1 \
     95 // RUN:   | FileCheck --check-prefix=CHECK-VFP4 %s
     96 // CHECK-VFP4: "-target-feature" "+vfp4"
     97 // CHECK-VFP4: "-target-feature" "-fp-armv8"
     98 // CHECK-VFP4: "-target-feature" "-neon"
     99 
    100 // RUN: %clang -target arm-linux-eabi -mfpu=vfp4-d16 %s -### -o %t.o 2>&1 \
    101 // RUN:   | FileCheck --check-prefix=CHECK-VFP4-D16 %s
    102 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4-d16 %s -### -o %t.o 2>&1 \
    103 // RUN:   | FileCheck --check-prefix=CHECK-VFP4-D16 %s
    104 // CHECK-VFP4-D16: "-target-feature" "-fp-only-sp"
    105 // CHECK-VFP4-D16: "-target-feature" "+d16"
    106 // CHECK-VFP4-D16: "-target-feature" "+vfp4"
    107 // CHECK-VFP4-D16: "-target-feature" "-fp-armv8"
    108 // CHECK-VFP4-D16: "-target-feature" "-neon"
    109 
    110 // RUN: %clang -target arm-linux-eabi -mfpu=fp4-sp-d16 %s -### -o %t.o 2>&1 \
    111 // RUN:   | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s
    112 // RUN: %clang -target arm-linux-eabi -mfpu=fpv4-sp-d16 %s -### -o %t.o 2>&1 \
    113 // RUN:   | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s
    114 // CHECK-FP4-SP-D16: "-target-feature" "+fp-only-sp"
    115 // CHECK-FP4-SP-D16: "-target-feature" "+d16"
    116 // CHECK-FP4-SP-D16: "-target-feature" "+vfp4"
    117 // CHECK-FP4-SP-D16: "-target-feature" "-fp-armv8"
    118 // CHECK-FP4-SP-D16: "-target-feature" "-neon"
    119 
    120 // RUN: %clang -target arm-linux-eabi -mfpu=fp5-sp-d16 %s -### -o %t.o 2>&1 \
    121 // RUN:   | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s
    122 // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-sp-d16 %s -### -o %t.o 2>&1 \
    123 // RUN:   | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s
    124 // CHECK-FP5-SP-D16: "-target-feature" "+fp-only-sp"
    125 // CHECK-FP5-SP-D16: "-target-feature" "+d16"
    126 // CHECK-FP5-SP-D16: "-target-feature" "+fp-armv8"
    127 // CHECK-FP5-SP-D16: "-target-feature" "-neon"
    128 // CHECK-FP5-SP-D16: "-target-feature" "-crypto"
    129 
    130 // RUN: %clang -target arm-linux-eabi -mfpu=fp5-dp-d16 %s -### -o %t.o 2>&1 \
    131 // RUN:   | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s
    132 // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-dp-d16 %s -### -o %t.o 2>&1 \
    133 // RUN:   | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s
    134 // CHECK-FP5-DP-D16: "-target-feature" "-fp-only-sp"
    135 // CHECK-FP5-DP-D16: "-target-feature" "+d16"
    136 // CHECK-FP5-DP-D16: "-target-feature" "+fp-armv8"
    137 // CHECK-FP5-DP-D16: "-target-feature" "-neon"
    138 // CHECK-FP5-DP-D16: "-target-feature" "-crypto"
    139 
    140 // RUN: %clang -target arm-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \
    141 // RUN:   | FileCheck --check-prefix=CHECK-NEON %s
    142 // CHECK-NEON: "-target-feature" "+neon"
    143 
    144 // RUN: %clang -target arm-linux-eabi -mfpu=neon-fp16 %s -### -o %t.o 2>&1 \
    145 // RUN:   | FileCheck --check-prefix=CHECK-NEON-FP16 %s
    146 // CHECK-NEON-FP16: "-target-feature" "-fp-only-sp"
    147 // CHECK-NEON-FP16: "-target-feature" "-d16"
    148 // CHECK-NEON-FP16: "-target-feature" "+vfp3"
    149 // CHECK-NEON-FP16: "-target-feature" "+fp16"
    150 // CHECK-NEON-FP16: "-target-feature" "-vfp4"
    151 // CHECK-NEON-FP16: "-target-feature" "-fp-armv8"
    152 // CHECK-NEON-FP16: "-target-feature" "+neon"
    153 // CHECK-NEON-FP16: "-target-feature" "-crypto"
    154 
    155 // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv3 %s -### -o %t.o 2>&1 \
    156 // RUN:   | FileCheck --check-prefix=CHECK-NEON-VFPV3 %s
    157 // CHECK-NEON-VFPV3: "-target-feature" "+neon"
    158 
    159 // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv4 %s -### -o %t.o 2>&1 \
    160 // RUN:   | FileCheck --check-prefix=CHECK-NEON-VFPV4 %s
    161 // CHECK-NEON-VFPV4: "-target-feature" "+vfp4"
    162 // CHECK-NEON-VFPV4: "-target-feature" "+neon"
    163 
    164 // RUN: %clang -target arm-linux-eabi -msoft-float %s -### -o %t.o 2>&1 \
    165 // RUN:   | FileCheck --check-prefix=CHECK-SOFT-FLOAT %s
    166 // CHECK-SOFT-FLOAT: "-target-feature" "-neon"
    167 
    168 // RUN: %clang -target armv8 %s -### 2>&1 \
    169 // RUN:   | FileCheck --check-prefix=CHECK-ARMV8-DEFAULT-SOFT-FP %s
    170 // CHECK-ARMV8-DEFAULT-SOFT-FP: "-target-feature" "-neon"
    171 // CHECK-ARMV8-DEFAULT-SOFT-FP: "-target-feature" "-crypto"
    172 
    173 // RUN: %clang -target armv8 -mfpu=fp-armv8 %s -### 2>&1 \
    174 // RUN:   | FileCheck --check-prefix=CHECK-ARMV8-SOFT-FLOAT %s
    175 // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "+fp-armv8"
    176 // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-neon"
    177 // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-crypto"
    178 
    179 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=fp-armv8 %s -### 2>&1 \
    180 // RUN:   | FileCheck --check-prefix=CHECK-FP-ARMV8 %s
    181 // CHECK-FP-ARMV8-NOT: "-target-feature" "+neon"
    182 // CHECK-FP-ARMV8: "-target-feature" "+fp-armv8"
    183 // CHECK-FP-ARMV8: "-target-feature" "-neon"
    184 // CHECK-FP-ARMV8: "-target-feature" "-crypto"
    185 
    186 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=neon-fp-armv8 %s -### 2>&1 \
    187 // RUN:   | FileCheck --check-prefix=CHECK-NEON-FP-ARMV8 %s
    188 // CHECK-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
    189 // CHECK-NEON-FP-ARMV8: "-target-feature" "+neon"
    190 // CHECK-NEON-FP-ARMV8: "-target-feature" "-crypto"
    191 
    192 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=crypto-neon-fp-armv8 %s -### 2>&1 \
    193 // RUN:   | FileCheck --check-prefix=CHECK-CRYPTO-NEON-FP-ARMV8 %s
    194 // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
    195 // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+crypto"
    196 
    197 // RUN: %clang -target armv8-linux-gnueabi -mfpu=none %s -### 2>&1 \
    198 // RUN:   | FileCheck --check-prefix=CHECK-NO-FP %s
    199 // CHECK-NO-FP: "-target-feature" "-fp-only-sp"
    200 // CHECK-NO-FP: "-target-feature" "-d16"
    201 // CHECK-NO-FP: "-target-feature" "-vfp2"
    202 // CHECK-NO-FP: "-target-feature" "-vfp3"
    203 // CHECK-NO-FP: "-target-feature" "-vfp4"
    204 // CHECK-NO-FP: "-target-feature" "-fp-armv8"
    205 // CHECK-NO-FP: "-target-feature" "-neon"
    206 // CHECK-NO-FP: "-target-feature" "-crypto"
    207 
    208 // RUN: %clang -target arm-linux-gnueabihf %s -### 2>&1 \
    209 // RUN:   | FileCheck --check-prefix=CHECK-HF %s
    210 // RUN: %clang -target arm-linux-musleabihf %s -### 2>&1 \
    211 // RUN:   | FileCheck --check-prefix=CHECK-HF %s
    212 // CHECK-HF: "-target-cpu" "arm1176jzf-s"
    213 
    214 // RUN: %clang -target armv7-apple-darwin -x assembler %s -### -c 2>&1 \
    215 // RUN:   | FileCheck --check-prefix=ASM %s
    216 // ASM-NOT: -target-feature
    217