mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
f0569be4a9
DAGcombine's ability to find reasons to remove truncates when they were not needed. Consequently, the CellSPU backend would produce correct, but _really slow and horrible_, code. Replaced with instruction sequences that do the equivalent truncation in SPUInstrInfo.td. - Re-examine how unaligned loads and stores work. Generated unaligned load code has been tested on the CellSPU hardware; see the i32operations.c and i64operations.c in CodeGen/CellSPU/useful-harnesses. (While they may be toy test code, it does prove that some real world code does compile correctly.) - Fix truncating stores in bug 3193 (note: unpack_df.ll will still make llc fault because i64 ult is not yet implemented.) - Added i64 eq and neq for setcc and select/setcc; started new instruction information file for them in SPU64InstrInfo.td. Additional i64 operations should be added to this file and not to SPUInstrInfo.td. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61447 91177308-0d34-0410-b5e6-96231b3b80d8
70 lines
2.1 KiB
C
70 lines
2.1 KiB
C
#include <stdio.h>
|
|
|
|
typedef unsigned int uint32_t;
|
|
typedef int int32_t;
|
|
|
|
const char *boolstring(int val) {
|
|
return val ? "true" : "false";
|
|
}
|
|
|
|
int i32_eq(int32_t a, int32_t b) {
|
|
return (a == b);
|
|
}
|
|
|
|
int i32_neq(int32_t a, int32_t b) {
|
|
return (a != b);
|
|
}
|
|
|
|
int32_t i32_eq_select(int32_t a, int32_t b, int32_t c, int32_t d) {
|
|
return ((a == b) ? c : d);
|
|
}
|
|
|
|
int32_t i32_neq_select(int32_t a, int32_t b, int32_t c, int32_t d) {
|
|
return ((a != b) ? c : d);
|
|
}
|
|
|
|
struct pred_s {
|
|
const char *name;
|
|
int (*predfunc)(int32_t, int32_t);
|
|
int (*selfunc)(int32_t, int32_t, int32_t, int32_t);
|
|
};
|
|
|
|
struct pred_s preds[] = {
|
|
{ "eq", i32_eq, i32_eq_select },
|
|
{ "neq", i32_neq, i32_neq_select }
|
|
};
|
|
|
|
int main(void) {
|
|
int i;
|
|
int32_t a = 1234567890;
|
|
int32_t b = 345678901;
|
|
int32_t c = 1234500000;
|
|
int32_t d = 10001;
|
|
int32_t e = 10000;
|
|
|
|
printf("a = %12d (0x%08x)\n", a, a);
|
|
printf("b = %12d (0x%08x)\n", b, b);
|
|
printf("c = %12d (0x%08x)\n", c, c);
|
|
printf("d = %12d (0x%08x)\n", d, d);
|
|
printf("e = %12d (0x%08x)\n", e, e);
|
|
printf("----------------------------------------\n");
|
|
|
|
for (i = 0; i < sizeof(preds)/sizeof(preds[0]); ++i) {
|
|
printf("a %s a = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(a, a)));
|
|
printf("a %s a = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(a, a)));
|
|
printf("a %s b = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(a, b)));
|
|
printf("a %s c = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(a, c)));
|
|
printf("d %s e = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(d, e)));
|
|
printf("e %s e = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(e, e)));
|
|
|
|
printf("a %s a ? c : d = %d\n", preds[i].name, (*preds[i].selfunc)(a, a, c, d));
|
|
printf("a %s a ? c : d == c (%s)\n", preds[i].name, boolstring((*preds[i].selfunc)(a, a, c, d) == c));
|
|
printf("a %s b ? c : d = %d\n", preds[i].name, (*preds[i].selfunc)(a, b, c, d));
|
|
printf("a %s b ? c : d == d (%s)\n", preds[i].name, boolstring((*preds[i].selfunc)(a, b, c, d) == d));
|
|
|
|
printf("----------------------------------------\n");
|
|
}
|
|
|
|
return 0;
|
|
}
|