Permalink
Browse files

Fix a regression in the image.vhd test

  • Loading branch information...
1 parent 7047e27 commit 66d6e92ca074af9eaa291821f3a0485d63a18040 @nickg committed Apr 11, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/cgen.c
View
4 src/cgen.c
@@ -999,8 +999,10 @@ static LLVMValueRef cgen_fcall(tree_t t, struct cgen_ctx *ctx)
tree_type(tree_param(t, 1).value),
LLVMIntNE, ctx);
else if (icmp(builtin, "image")) {
+ bool is_signed = (type_kind(type_base_recur(arg_type)) == T_INTEGER);
+ LLVMOpcode op = (is_signed ? LLVMSExt : LLVMZExt);
LLVMValueRef iargs[] = {
- LLVMBuildZExtOrBitCast(builder, args[0], LLVMInt64Type(), ""),
+ LLVMBuildCast(builder, op, args[0], LLVMInt64Type(), ""),
llvm_int32(tree_index(tree_param(t, 0).value)),
LLVMBuildPointerCast(builder, mod_name,
LLVMPointerType(LLVMInt8Type(), 0), "")

0 comments on commit 66d6e92

Please sign in to comment.