> On Tue, Nov 22, 2011 at 9:58 AM, Pekka Enberg <penberg@xxxxxxxxxx> wrote: >> >> Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> On Tue, Nov 22, 2011 at 8:05 PM, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > Hey, I obviously like it since I suggested it, but I wonder if you > shouldn't handle the FP cases too? > > You have lost the > > assert(!symbol_is_fp_type(insn->type)); > > but I do suspect that the same code should be able to largely just > handle the FP cases (you'd obviously need to translate the sparse > OP_SET_NE things into the proper LLVM LLVMfpEQ or whatever LLVM does). > > That said, if you don't handle the FP cases, I think you should > re-introduce the assert(). Actually, the assert() doesn't catch anything. With something like this: diff --git a/sparse-llvm.c b/sparse-llvm.c index 4ef02a1..3806876 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -514,6 +514,8 @@ static void output_op_binary(struct function *fn, struct instruction *insn) case OP_BINCMP ... OP_BINCMP_END: { LLVMIntPredicate op = translate_op(insn->opcode); + assert(!symbol_is_fp_type(insn->type)); + target = LLVMBuildICmp(fn->builder, op, lhs, rhs, target_name); break; } diff --git a/validation/backend/cmp-ops.c b/validation/backend/cmp-ops.c index 7bbc81c..d8b5e9a 100644 --- a/validation/backend/cmp-ops.c +++ b/validation/backend/cmp-ops.c @@ -8,6 +8,11 @@ static int setne(int x, int y) return x != y; } +static int fsetl(float x, float y) +{ + return x < y; +} + static int setl(int x, int y) { return x < y; You hit this assertion in LLVM: [penberg@tux sparse]$ ./sparse-llvm validation/backend/cmp-ops.c sparse-llvm: /home/penberg/llvm/include/llvm/Instructions.h:949: llvm::ICmpInst::ICmpInst(llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, const llvm::Twine&): Assertion `(getOperand(0)->getType()->isIntOrIntVectorTy() || getOperand(0)->getType()->isPointerTy()) && "Invalid operand types for ICmp instruction"' failed. Aborted I think that might be a generic sparse floating point issue but I didn't look too closely. Pekka -- 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