diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
commit | e5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch) | |
tree | d8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/qc/machcap.c |
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/qc/machcap.c')
-rwxr-xr-x | sys/src/cmd/qc/machcap.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/sys/src/cmd/qc/machcap.c b/sys/src/cmd/qc/machcap.c new file mode 100755 index 000000000..e9f9a9881 --- /dev/null +++ b/sys/src/cmd/qc/machcap.c @@ -0,0 +1,98 @@ +#include "gc.h" + +int +machcap(Node *n) +{ + if(n == Z) + return 1; /* test */ + switch(n->op){ + + case OADD: + case OAND: + case OOR: + case OSUB: + case OXOR: + if(typev[n->left->type->etype]) + return 1; + break; + + case OMUL: + case OLMUL: + case OASMUL: + case OASLMUL: + return 1; + + case OLSHR: + case OASHR: + case OASHL: + case OASASHL: + case OASASHR: + case OASLSHR: + return 1; + + case OCAST: + if(typev[n->type->etype]) { + if(!typefd[n->left->type->etype]) + return 1; + } else if(!typefd[n->type->etype]) { + if(typev[n->left->type->etype]) + return 1; + } + break; + + case OCOMMA: + case OCOND: + case OLIST: + case OANDAND: + case OOROR: + case ONOT: + return 1; + + case OCOM: + case ONEG: + if(typechl[n->left->type->etype]) + return 1; + if(typev[n->left->type->etype]) + return 1; + return 0; + + case OASADD: + case OASSUB: + case OASAND: + case OASOR: + case OASXOR: + return 1; + + case OPOSTINC: + case OPOSTDEC: + case OPREINC: + case OPREDEC: + return 1; + + case OEQ: + case ONE: + case OLE: + case OGT: + case OLT: + case OGE: + case OHI: + case OHS: + case OLO: + case OLS: + return 1; + + case ODIV: + case OLDIV: + case OLMOD: + case OMOD: + return 0; + + case OASDIV: + case OASLDIV: + case OASLMOD: + case OASMOD: + return 0; + + } + return 0; +} |