Sanjay Patel | 2987c29 | 2015-06-11 14:53:41 +0000 | [diff] [blame] | 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 | //// Check optional refinement step specifiers. |
| 41 | |
| 42 | // RUN: %clang -### -S %s -mrecip=all:1 2>&1 | FileCheck --check-prefix=RECIP9 %s |
| 43 | // RECIP9: "-mrecip=all:1" |
| 44 | |
| 45 | // RUN: %clang -### -S %s -mrecip=sqrtf:3 2>&1 | FileCheck --check-prefix=RECIP10 %s |
| 46 | // RECIP10: "-mrecip=sqrtf:3" |
| 47 | |
| 48 | // RUN: %clang -### -S %s -mrecip=div:5 2>&1 | FileCheck --check-prefix=RECIP11 %s |
| 49 | // RECIP11: "-mrecip=div:5" |
| 50 | |
| 51 | // RUN: %clang -### -S %s -mrecip=divd:1,!sqrtf:2,vec-divf:9,vec-sqrtd:0 2>&1 | FileCheck --check-prefix=RECIP12 %s |
| 52 | // RECIP12: "-mrecip=divd:1,!sqrtf:2,vec-divf:9,vec-sqrtd:0" |
| 53 | |
| 54 | //// Check invalid parameters. |
| 55 | |
| 56 | // RUN: %clang -### -S %s -mrecip=bogus 2>&1 | FileCheck --check-prefix=RECIP13 %s |
| 57 | // RECIP13: error: unknown argument |
| 58 | |
| 59 | // RUN: %clang -### -S %s -mrecip=divd:1,divd 2>&1 | FileCheck --check-prefix=RECIP14 %s |
| 60 | // RECIP14: error: invalid value |
| 61 | |
| 62 | // RUN: %clang -### -S %s -mrecip=sqrt,sqrtf 2>&1 | FileCheck --check-prefix=RECIP15 %s |
| 63 | // RECIP15: error: invalid value |
| 64 | |
| 65 | // RUN: %clang -### -S %s -mrecip=+default:10 2>&1 | FileCheck --check-prefix=RECIP16 %s |
| 66 | // RECIP16: error: invalid value |
| 67 | |
| 68 | // RUN: %clang -### -S %s -mrecip=!vec-divd: 2>&1 | FileCheck --check-prefix=RECIP17 %s |
| 69 | // RECIP17: error: invalid value |
| 70 | |