xref: /llvm-project/clang/test/Driver/mrecip.c (revision f39c399d9d15efe8309d8aa3d0ecf62205e6c474)
1 ////
2 //// Verify that valid options for the -mrecip flag are passed through and invalid options cause an error.
3 ////
4 
5 //// If there are no options, convert to 'all'.
6 
7 // RUN: %clang -### -S %s -mrecip  2>&1 | FileCheck --check-prefix=RECIP0 %s
8 // RECIP0: "-mrecip=all"
9 
10 //// Check options that cover all types.
11 
12 // RUN: %clang -### -S %s -mrecip=all  2>&1 | FileCheck --check-prefix=RECIP1 %s
13 // RECIP1: "-mrecip=all"
14 
15 // RUN: %clang -### -S %s -mrecip=default  2>&1 | FileCheck --check-prefix=RECIP2 %s
16 // RECIP2: "-mrecip=default"
17 
18 // RUN: %clang -### -S %s -mrecip=none  2>&1 | FileCheck --check-prefix=RECIP3 %s
19 // RECIP3: "-mrecip=none"
20 
21 //// Check options that do not specify float or double.
22 
23 // RUN: %clang -### -S %s -mrecip=vec-sqrt  2>&1 | FileCheck --check-prefix=RECIP4 %s
24 // RECIP4: "-mrecip=vec-sqrt"
25 
26 // RUN: %clang -### -S %s -mrecip=!div,vec-div  2>&1 | FileCheck --check-prefix=RECIP5 %s
27 // RECIP5: "-mrecip=!div,vec-div"
28 
29 //// Check individual option types.
30 
31 // RUN: %clang -### -S %s -mrecip=vec-sqrtd  2>&1 | FileCheck --check-prefix=RECIP6 %s
32 // RECIP6: "-mrecip=vec-sqrtd"
33 
34 // RUN: %clang -### -S %s -mrecip=!divf  2>&1 | FileCheck --check-prefix=RECIP7 %s
35 // RECIP7: "-mrecip=!divf"
36 
37 // RUN: %clang -### -S %s -mrecip=divf,sqrtd,vec-divd,vec-sqrtf  2>&1 | FileCheck --check-prefix=RECIP8 %s
38 // RECIP8: "-mrecip=divf,sqrtd,vec-divd,vec-sqrtf"
39 
40 // RUN: %clang -### -S %s -mrecip=vec-sqrth  2>&1 | FileCheck --check-prefix=RECIP18 %s
41 // RECIP18: "-mrecip=vec-sqrth"
42 
43 //// Check optional refinement step specifiers.
44 
45 // RUN: %clang -### -S %s -mrecip=all:1  2>&1 | FileCheck --check-prefix=RECIP9 %s
46 // RECIP9: "-mrecip=all:1"
47 
48 // RUN: %clang -### -S %s -mrecip=sqrtf:3  2>&1 | FileCheck --check-prefix=RECIP10 %s
49 // RECIP10: "-mrecip=sqrtf:3"
50 
51 // RUN: %clang -### -S %s -mrecip=div:5  2>&1 | FileCheck --check-prefix=RECIP11 %s
52 // RECIP11: "-mrecip=div:5"
53 
54 // RUN: %clang -### -S %s -mrecip=divd:1,!sqrtf:2,vec-divf:9,vec-sqrtd:0  2>&1 | FileCheck --check-prefix=RECIP12 %s
55 // RECIP12: "-mrecip=divd:1,!sqrtf:2,vec-divf:9,vec-sqrtd:0"
56 
57 // RUN: %clang -### -S %s -mrecip=sqrth:2  2>&1 | FileCheck --check-prefix=RECIP19 %s
58 // RECIP19: "-mrecip=sqrth:2"
59 
60 //// Check invalid parameters.
61 
62 // RUN: not %clang -### -S %s -mrecip=bogus  2>&1 | FileCheck --check-prefix=RECIP13 %s
63 // RECIP13: error: unknown argument
64 
65 // RUN: not %clang -### -S %s -mrecip=divd:1,divd  2>&1 | FileCheck --check-prefix=RECIP14 %s
66 // RECIP14: error: invalid value
67 
68 // RUN: not %clang -### -S %s -mrecip=sqrt,sqrtf  2>&1 | FileCheck --check-prefix=RECIP15 %s
69 // RECIP15: error: invalid value
70 
71 // RUN: not %clang -### -S %s -mrecip=+default:10  2>&1 | FileCheck --check-prefix=RECIP16 %s
72 // RECIP16: error: invalid value
73 
74 // RUN: not %clang -### -S %s -mrecip=!vec-divd:  2>&1 | FileCheck --check-prefix=RECIP17 %s
75 // RECIP17: error: invalid value
76 
77 // RUN: not %clang -### -S %s -mrecip=divh:1,divh  2>&1 | FileCheck --check-prefix=RECIP20 %s
78 // RECIP20: error: invalid value
79 
80 // RUN: not %clang -### -S %s -mrecip=divh,div  2>&1 | FileCheck --check-prefix=RECIP21 %s
81 // RECIP21: error: invalid value
82 
83 // RUN: not %clang -### -S %s -mrecip=sqrt,sqrth  2>&1 | FileCheck --check-prefix=RECIP22 %s
84 // RECIP22: error: invalid value
85