sparse-llvm has not yet support for OP_NEG (which need to be done via a subtraction from zero). Fix this by issuing the appropriate substraction. CC: Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- sparse-llvm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sparse-llvm.c b/sparse-llvm.c index ee374b217..c489009a6 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -951,9 +951,22 @@ static void output_insn(struct function *fn, struct instruction *insn) insn->target->priv = target; break; } - case OP_NEG: - assert(0); + case OP_NEG: { + LLVMValueRef src, target; + char target_name[64]; + + src = pseudo_to_value(fn, insn, insn->src); + + pseudo_name(insn->target, target_name); + + if (symbol_is_fp_type(insn->type)) + target = LLVMBuildFNeg(fn->builder, src, target_name); + else + target = LLVMBuildNeg(fn->builder, src, target_name); + + insn->target->priv = target; break; + } case OP_CONTEXT: assert(0); break; -- 2.11.1 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html