diff options
author | Matt Turner <[email protected]> | 2017-09-18 14:07:20 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2017-10-04 14:08:54 -0700 |
commit | 122ef3799d5612748afd8b15392c4a819a1b1847 (patch) | |
tree | 6ba4f44282628737a2820fa0a365fb6d538e8f06 /src/intel/compiler/brw_eu_validate.c | |
parent | 5e76cf153c980d5c4719376e6653729bcf2db512 (diff) |
i965: Only insert error message if not already present
Some restrictions require something like strides to match between src
and dest. For multi-source instructions, I'd rather encapsulate the
logic for not inserting already present errors in ERROR_IF than
open-coding it multiple places.
Diffstat (limited to 'src/intel/compiler/brw_eu_validate.c')
-rw-r--r-- | src/intel/compiler/brw_eu_validate.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/intel/compiler/brw_eu_validate.c b/src/intel/compiler/brw_eu_validate.c index 99abc6b4f9e..8fcc5293666 100644 --- a/src/intel/compiler/brw_eu_validate.c +++ b/src/intel/compiler/brw_eu_validate.c @@ -44,15 +44,23 @@ cat(struct string *dest, const struct string src) } #define CAT(dest, src) cat(&dest, (struct string){src, strlen(src)}) +static bool +contains(const struct string haystack, const struct string needle) +{ + return memmem(haystack.str, haystack.len, needle.str, needle.len) != NULL; +} +#define CONTAINS(haystack, needle) \ + contains(haystack, (struct string){needle, strlen(needle)}) + #define error(str) "\tERROR: " str "\n" #define ERROR_INDENT "\t " #define ERROR(msg) ERROR_IF(true, msg) -#define ERROR_IF(cond, msg) \ - do { \ - if (cond) { \ - CAT(error_msg, error(msg)); \ - } \ +#define ERROR_IF(cond, msg) \ + do { \ + if ((cond) && !CONTAINS(error_msg, error(msg))) { \ + CAT(error_msg, error(msg)); \ + } \ } while(0) #define CHECK(func, args...) \ |