diff options
| -rw-r--r-- | sparse-llvm.c | 15 | ||||
| -rw-r--r-- | validation/backend/bitwise-ops.c | 10 |
2 files changed, 24 insertions, 1 deletions
diff --git a/sparse-llvm.c b/sparse-llvm.c index 3091b597..3dc51c94 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -478,7 +478,20 @@ static void output_insn(struct function *fn, struct instruction *insn) case OP_SLICE: assert(0); break; - case OP_NOT: case OP_NEG: + case OP_NOT: { + LLVMValueRef src, target; + char target_name[64]; + + src = pseudo_to_value(fn, insn->src); + + pseudo_name(insn->target, target_name); + + target = LLVMBuildNot(fn->builder, src, target_name); + + insn->target->priv = target; + break; + } + case OP_NEG: assert(0); break; case OP_CONTEXT: diff --git a/validation/backend/bitwise-ops.c b/validation/backend/bitwise-ops.c index aa1029e4..659c7639 100644 --- a/validation/backend/bitwise-ops.c +++ b/validation/backend/bitwise-ops.c @@ -48,6 +48,16 @@ static unsigned int uxor(unsigned int x, unsigned int y) return x ^ y; } +static int not(int x) +{ + return ~x; +} + +static unsigned int unot(unsigned int x) +{ + return ~x; +} + /* * check-name: Bitwise operator code generation * check-command: ./sparsec -c $file -o tmp.o |
