From c3af68dc5022715cc8f126b7df12f3f5248aefe7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 11 Dec 2007 14:39:37 +0000 Subject: gallium: remove set_sampler_units interface The effect of this mapping can be acheived by the state tracker and setting up the pipe texture state pointers to incorporate its affects. --- src/mesa/pipe/llvm/llvm_base_shader.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/mesa/pipe/llvm/llvm_base_shader.cpp') diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp index f141ea2da0..a703ba3862 100644 --- a/src/mesa/pipe/llvm/llvm_base_shader.cpp +++ b/src/mesa/pipe/llvm/llvm_base_shader.cpp @@ -770,8 +770,6 @@ Module* createBaseShader() { int32_num_consts_125->setName("num_consts"); Value* ptr_samplers = args++; ptr_samplers->setName("samplers"); - Value* ptr_sampler_units = args++; - ptr_sampler_units->setName("sampler_units"); BasicBlock* label_entry_126 = new BasicBlock("entry",func_run_fragment_shader,0); BasicBlock* label_forbody6_i_127 = new BasicBlock("forbody6.i",func_run_fragment_shader,0); -- cgit v1.2.3 From 8681deddd7a7e749adaf43c7df4313ea54922e62 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 5 Nov 2007 13:41:56 -0500 Subject: Rewrite argument passing to prepare for handling of the kil instruction. Pass the inputs/outputs pointer in the structure instead of infinitely expanding arguments to the functions. --- src/mesa/pipe/llvm/gallivm.cpp | 18 +- src/mesa/pipe/llvm/instructions.cpp | 20 +- src/mesa/pipe/llvm/instructions.h | 3 +- src/mesa/pipe/llvm/llvm_base_shader.cpp | 1425 ++++++++++++++++--------------- src/mesa/pipe/llvm/llvm_entry.c | 41 +- src/mesa/pipe/llvm/storage.cpp | 190 ++--- src/mesa/pipe/llvm/storage.h | 35 +- 7 files changed, 852 insertions(+), 880 deletions(-) (limited to 'src/mesa/pipe/llvm/llvm_base_shader.cpp') diff --git a/src/mesa/pipe/llvm/gallivm.cpp b/src/mesa/pipe/llvm/gallivm.cpp index a60440022a..65c95074fd 100644 --- a/src/mesa/pipe/llvm/gallivm.cpp +++ b/src/mesa/pipe/llvm/gallivm.cpp @@ -485,11 +485,7 @@ translate_instruction(llvm::Module *module, case TGSI_OPCODE_BRA: break; case TGSI_OPCODE_CAL: { - instr->cal(inst->InstructionExtLabel.Label, - storage->outputPtr(), - storage->inputPtr(), - storage->constPtr(), - storage->tempPtr()); + instr->cal(inst->InstructionExtLabel.Label, storage->inputPtr()); return; } break; @@ -740,14 +736,8 @@ tgsi_to_llvm(struct gallivm_prog *prog, const struct tgsi_token *tokens) shader->setName(func_name.c_str()); Function::arg_iterator args = shader->arg_begin(); - Value *ptr_OUT = args++; - ptr_OUT->setName("OUT"); - Value *ptr_IN = args++; - ptr_IN->setName("IN"); - Value *ptr_CONST = args++; - ptr_CONST->setName("CONST"); - Value *ptr_TEMPS = args++; - ptr_TEMPS->setName("TEMPS"); + Value *ptr_INPUT = args++; + ptr_INPUT->setName("input"); BasicBlock *label_entry = new BasicBlock("entry", shader, 0); @@ -755,7 +745,7 @@ tgsi_to_llvm(struct gallivm_prog *prog, const struct tgsi_token *tokens) fi = tgsi_default_full_instruction(); fd = tgsi_default_full_declaration(); - Storage storage(label_entry, ptr_OUT, ptr_IN, ptr_CONST, ptr_TEMPS); + Storage storage(label_entry, ptr_INPUT); Instructions instr(mod, shader, label_entry, &storage); while(!tgsi_parse_end_of_tokens(&parse)) { tgsi_parse_token(&parse); diff --git a/src/mesa/pipe/llvm/instructions.cpp b/src/mesa/pipe/llvm/instructions.cpp index 232dd9cd5d..7a70aec878 100644 --- a/src/mesa/pipe/llvm/instructions.cpp +++ b/src/mesa/pipe/llvm/instructions.cpp @@ -732,14 +732,10 @@ void Instructions::end() m_builder.CreateRetVoid(); } -void Instructions::cal(int label, llvm::Value *out, llvm::Value *in, - llvm::Value *cst, llvm::Value *temp) +void Instructions::cal(int label, llvm::Value *input) { std::vector params; - params.push_back(out); - params.push_back(in); - params.push_back(cst); - params.push_back(temp); + params.push_back(input); llvm::Function *func = findFunction(label); m_builder.CreateCall(func, params.begin(), params.end()); @@ -773,15 +769,9 @@ void Instructions::bgnSub(unsigned label) llvm::Function *func = findFunction(label); Function::arg_iterator args = func->arg_begin(); - Value *ptr_OUT = args++; - ptr_OUT->setName("OUT"); - Value *ptr_IN = args++; - ptr_IN->setName("IN"); - Value *ptr_CONST = args++; - ptr_CONST->setName("CONST"); - Value *ptr_TEMP = args++; - ptr_TEMP->setName("TEMP"); - m_storage->pushArguments(ptr_OUT, ptr_IN, ptr_CONST, ptr_TEMP); + Value *ptr_INPUT = args++; + ptr_INPUT->setName("INPUT"); + m_storage->pushArguments(ptr_INPUT); llvm::BasicBlock *entry = new BasicBlock("entry", func, 0); diff --git a/src/mesa/pipe/llvm/instructions.h b/src/mesa/pipe/llvm/instructions.h index e9bfc9d740..c31cc4f125 100644 --- a/src/mesa/pipe/llvm/instructions.h +++ b/src/mesa/pipe/llvm/instructions.h @@ -62,8 +62,7 @@ public: void beginLoop(); void bgnSub(unsigned); void brk(); - void cal(int label, llvm::Value *out, llvm::Value *in, - llvm::Value *cst, llvm::Value *tmp); + void cal(int label, llvm::Value *input); llvm::Value *cmp(llvm::Value *in1, llvm::Value *in2, llvm::Value *in3); llvm::Value *cos(llvm::Value *in); llvm::Value *cross(llvm::Value *in1, llvm::Value *in2); diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp index a703ba3862..6e7fa32807 100644 --- a/src/mesa/pipe/llvm/llvm_base_shader.cpp +++ b/src/mesa/pipe/llvm/llvm_base_shader.cpp @@ -4,8 +4,23 @@ Module* createBaseShader() { // Module Construction Module* mod = new Module("Shader"); + mod->setDataLayout(""); + mod->setTargetTriple("i686-apple-darwin9"); // Type Definitions + std::vectorStructTy_struct_ShaderInput_fields; + VectorType* VectorTy_1 = VectorType::get(Type::FloatTy, 4); + + PointerType* PointerTy_0 = PointerType::get(VectorTy_1); + + StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); + StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); + StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); + StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); + StructTy_struct_ShaderInput_fields.push_back(IntegerType::get(32)); + StructType* StructTy_struct_ShaderInput = StructType::get(StructTy_struct_ShaderInput_fields, /*isPacked=*/false); + mod->addTypeName("struct.ShaderInput", StructTy_struct_ShaderInput); + OpaqueType* OpaqueTy_struct_pipe_mipmap_tree = OpaqueType::get(); mod->addTypeName("struct.pipe_mipmap_tree", OpaqueTy_struct_pipe_mipmap_tree); @@ -16,77 +31,73 @@ Module* createBaseShader() { mod->addTypeName("struct.softpipe_tile_cache", OpaqueTy_struct_softpipe_tile_cache); std::vectorStructTy_struct_tgsi_sampler_fields; - PointerType* PointerTy_0 = PointerType::get(OpaqueTy_struct_pipe_sampler_state); + PointerType* PointerTy_2 = PointerType::get(OpaqueTy_struct_pipe_sampler_state); - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_0); - PointerType* PointerTy_1 = PointerType::get(OpaqueTy_struct_pipe_mipmap_tree); + StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_2); + PointerType* PointerTy_3 = PointerType::get(OpaqueTy_struct_pipe_mipmap_tree); - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_1); - std::vectorFuncTy_3_args; + StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_3); + std::vectorFuncTy_5_args; PATypeHolder StructTy_struct_tgsi_sampler_fwd = OpaqueType::get(); - PointerType* PointerTy_4 = PointerType::get(StructTy_struct_tgsi_sampler_fwd); + PointerType* PointerTy_6 = PointerType::get(StructTy_struct_tgsi_sampler_fwd); - FuncTy_3_args.push_back(PointerTy_4); - PointerType* PointerTy_5 = PointerType::get(Type::FloatTy); + FuncTy_5_args.push_back(PointerTy_6); + PointerType* PointerTy_7 = PointerType::get(Type::FloatTy); - FuncTy_3_args.push_back(PointerTy_5); - FuncTy_3_args.push_back(PointerTy_5); - FuncTy_3_args.push_back(PointerTy_5); - FuncTy_3_args.push_back(Type::FloatTy); - ArrayType* ArrayTy_7 = ArrayType::get(Type::FloatTy, 4); + FuncTy_5_args.push_back(PointerTy_7); + FuncTy_5_args.push_back(PointerTy_7); + FuncTy_5_args.push_back(PointerTy_7); + FuncTy_5_args.push_back(Type::FloatTy); + ArrayType* ArrayTy_9 = ArrayType::get(Type::FloatTy, 4); - PointerType* PointerTy_6 = PointerType::get(ArrayTy_7); + PointerType* PointerTy_8 = PointerType::get(ArrayTy_9); - FuncTy_3_args.push_back(PointerTy_6); - ParamAttrsList *FuncTy_3_PAL = 0; - FunctionType* FuncTy_3 = FunctionType::get( + FuncTy_5_args.push_back(PointerTy_8); + ParamAttrsList *FuncTy_5_PAL = 0; + FunctionType* FuncTy_5 = FunctionType::get( /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_3_args, + /*Params=*/FuncTy_5_args, /*isVarArg=*/false, - /*ParamAttrs=*/FuncTy_3_PAL); + /*ParamAttrs=*/FuncTy_5_PAL); - PointerType* PointerTy_2 = PointerType::get(FuncTy_3); + PointerType* PointerTy_4 = PointerType::get(FuncTy_5); - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_2); - PointerType* PointerTy_8 = PointerType::get(IntegerType::get(8)); + StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_4); + PointerType* PointerTy_10 = PointerType::get(IntegerType::get(8)); - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_8); - PointerType* PointerTy_9 = PointerType::get(OpaqueTy_struct_softpipe_tile_cache); + StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_10); + PointerType* PointerTy_11 = PointerType::get(OpaqueTy_struct_softpipe_tile_cache); - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_9); + StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_11); StructType* StructTy_struct_tgsi_sampler = StructType::get(StructTy_struct_tgsi_sampler_fields, /*isPacked=*/false); mod->addTypeName("struct.tgsi_sampler", StructTy_struct_tgsi_sampler); cast(StructTy_struct_tgsi_sampler_fwd.get())->refineAbstractTypeTo(StructTy_struct_tgsi_sampler); StructTy_struct_tgsi_sampler = cast(StructTy_struct_tgsi_sampler_fwd.get()); - std::vectorFuncTy_10_args; - VectorType* VectorTy_13 = VectorType::get(Type::FloatTy, 4); - - ArrayType* ArrayTy_12 = ArrayType::get(VectorTy_13, 16); + std::vectorFuncTy_12_args; + ArrayType* ArrayTy_14 = ArrayType::get(VectorTy_1, 16); - PointerType* PointerTy_11 = PointerType::get(ArrayTy_12); + PointerType* PointerTy_13 = PointerType::get(ArrayTy_14); - FuncTy_10_args.push_back(PointerTy_11); - ArrayType* ArrayTy_15 = ArrayType::get(ArrayTy_7, 16); + FuncTy_12_args.push_back(PointerTy_13); + ArrayType* ArrayTy_16 = ArrayType::get(ArrayTy_9, 16); - PointerType* PointerTy_14 = PointerType::get(ArrayTy_15); + PointerType* PointerTy_15 = PointerType::get(ArrayTy_16); - FuncTy_10_args.push_back(PointerTy_14); - FuncTy_10_args.push_back(IntegerType::get(32)); - FuncTy_10_args.push_back(IntegerType::get(32)); - ParamAttrsList *FuncTy_10_PAL = 0; - FunctionType* FuncTy_10 = FunctionType::get( + FuncTy_12_args.push_back(PointerTy_15); + FuncTy_12_args.push_back(IntegerType::get(32)); + FuncTy_12_args.push_back(IntegerType::get(32)); + ParamAttrsList *FuncTy_12_PAL = 0; + FunctionType* FuncTy_12 = FunctionType::get( /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_10_args, + /*Params=*/FuncTy_12_args, /*isVarArg=*/false, - /*ParamAttrs=*/FuncTy_10_PAL); - - PointerType* PointerTy_16 = PointerType::get(VectorTy_13); + /*ParamAttrs=*/FuncTy_12_PAL); std::vectorFuncTy_17_args; - FuncTy_17_args.push_back(PointerTy_16); - FuncTy_17_args.push_back(PointerTy_6); + FuncTy_17_args.push_back(PointerTy_0); + FuncTy_17_args.push_back(PointerTy_8); FuncTy_17_args.push_back(IntegerType::get(32)); ParamAttrsList *FuncTy_17_PAL = 0; FunctionType* FuncTy_17 = FunctionType::get( @@ -96,8 +107,8 @@ Module* createBaseShader() { /*ParamAttrs=*/FuncTy_17_PAL); std::vectorFuncTy_18_args; - FuncTy_18_args.push_back(PointerTy_6); - FuncTy_18_args.push_back(PointerTy_16); + FuncTy_18_args.push_back(PointerTy_8); + FuncTy_18_args.push_back(PointerTy_0); FuncTy_18_args.push_back(IntegerType::get(32)); ParamAttrsList *FuncTy_18_PAL = 0; FunctionType* FuncTy_18 = FunctionType::get( @@ -107,9 +118,9 @@ Module* createBaseShader() { /*ParamAttrs=*/FuncTy_18_PAL); std::vectorFuncTy_19_args; - FuncTy_19_args.push_back(PointerTy_14); - FuncTy_19_args.push_back(PointerTy_14); - FuncTy_19_args.push_back(PointerTy_6); + FuncTy_19_args.push_back(PointerTy_15); + FuncTy_19_args.push_back(PointerTy_15); + FuncTy_19_args.push_back(PointerTy_8); FuncTy_19_args.push_back(IntegerType::get(32)); FuncTy_19_args.push_back(IntegerType::get(32)); FuncTy_19_args.push_back(IntegerType::get(32)); @@ -121,60 +132,61 @@ Module* createBaseShader() { /*isVarArg=*/false, /*ParamAttrs=*/FuncTy_19_PAL); - ArrayType* ArrayTy_21 = ArrayType::get(ArrayTy_12, 2048); + ArrayType* ArrayTy_21 = ArrayType::get(ArrayTy_14, 2048); PointerType* PointerTy_20 = PointerType::get(ArrayTy_21); - ArrayType* ArrayTy_23 = ArrayType::get(VectorTy_13, 32); + ArrayType* ArrayTy_23 = ArrayType::get(VectorTy_1, 32); PointerType* PointerTy_22 = PointerType::get(ArrayTy_23); - ArrayType* ArrayTy_25 = ArrayType::get(VectorTy_13, 128); + ArrayType* ArrayTy_25 = ArrayType::get(VectorTy_1, 128); PointerType* PointerTy_24 = PointerType::get(ArrayTy_25); - std::vectorFuncTy_27_args; - FuncTy_27_args.push_back(PointerTy_16); - FuncTy_27_args.push_back(PointerTy_16); - FuncTy_27_args.push_back(PointerTy_16); - FuncTy_27_args.push_back(PointerTy_16); - ParamAttrsList *FuncTy_27_PAL = 0; - FunctionType* FuncTy_27 = FunctionType::get( + PointerType* PointerTy_26 = PointerType::get(StructTy_struct_ShaderInput); + + PointerType* PointerTy_27 = PointerType::get(PointerTy_0); + + std::vectorFuncTy_29_args; + FuncTy_29_args.push_back(PointerTy_26); + ParamAttrsList *FuncTy_29_PAL = 0; + FunctionType* FuncTy_29 = FunctionType::get( /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_27_args, + /*Params=*/FuncTy_29_args, /*isVarArg=*/false, - /*ParamAttrs=*/FuncTy_27_PAL); + /*ParamAttrs=*/FuncTy_29_PAL); - PointerType* PointerTy_26 = PointerType::get(FuncTy_27); + PointerType* PointerTy_28 = PointerType::get(FuncTy_29); - std::vectorFuncTy_28_args; - FuncTy_28_args.push_back(Type::FloatTy); - FuncTy_28_args.push_back(Type::FloatTy); - FuncTy_28_args.push_back(PointerTy_14); - FuncTy_28_args.push_back(PointerTy_14); - FuncTy_28_args.push_back(IntegerType::get(32)); - FuncTy_28_args.push_back(PointerTy_6); - FuncTy_28_args.push_back(IntegerType::get(32)); - FuncTy_28_args.push_back(PointerTy_4); - PointerType* PointerTy_29 = PointerType::get(IntegerType::get(32)); + std::vectorFuncTy_30_args; + FuncTy_30_args.push_back(Type::FloatTy); + FuncTy_30_args.push_back(Type::FloatTy); + FuncTy_30_args.push_back(PointerTy_15); + FuncTy_30_args.push_back(PointerTy_15); + FuncTy_30_args.push_back(IntegerType::get(32)); + FuncTy_30_args.push_back(PointerTy_8); + FuncTy_30_args.push_back(IntegerType::get(32)); + FuncTy_30_args.push_back(PointerTy_6); + PointerType* PointerTy_31 = PointerType::get(IntegerType::get(32)); - FuncTy_28_args.push_back(PointerTy_29); - ParamAttrsList *FuncTy_28_PAL = 0; - FunctionType* FuncTy_28 = FunctionType::get( + FuncTy_30_args.push_back(PointerTy_31); + ParamAttrsList *FuncTy_30_PAL = 0; + FunctionType* FuncTy_30 = FunctionType::get( /*Result=*/IntegerType::get(32), - /*Params=*/FuncTy_28_args, + /*Params=*/FuncTy_30_args, /*isVarArg=*/false, - /*ParamAttrs=*/FuncTy_28_PAL); + /*ParamAttrs=*/FuncTy_30_PAL); - ArrayType* ArrayTy_31 = ArrayType::get(ArrayTy_12, 4); + ArrayType* ArrayTy_33 = ArrayType::get(ArrayTy_14, 4); - PointerType* PointerTy_30 = PointerType::get(ArrayTy_31); + PointerType* PointerTy_32 = PointerType::get(ArrayTy_33); // Function Declarations Function* func_from_array = new Function( - /*Type=*/FuncTy_10, + /*Type=*/FuncTy_12, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"from_array", mod); func_from_array->setCallingConv(CallingConv::C); @@ -198,13 +210,13 @@ Module* createBaseShader() { func_run_vertex_shader->setCallingConv(CallingConv::C); Function* func_execute_shader = new Function( - /*Type=*/FuncTy_27, + /*Type=*/FuncTy_29, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"execute_shader", mod); // (external, no body) func_execute_shader->setCallingConv(CallingConv::C); Function* func_run_fragment_shader = new Function( - /*Type=*/FuncTy_28, + /*Type=*/FuncTy_30, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"run_fragment_shader", mod); func_run_fragment_shader->setCallingConv(CallingConv::C); @@ -213,13 +225,13 @@ Module* createBaseShader() { // Constant Definitions - Constant* const_int32_32 = Constant::getNullValue(IntegerType::get(32)); - UndefValue* const_packed_33 = UndefValue::get(VectorTy_13); - ConstantInt* const_int32_34 = ConstantInt::get(APInt(32, "1", 10)); - ConstantInt* const_int32_35 = ConstantInt::get(APInt(32, "2", 10)); - ConstantInt* const_int32_36 = ConstantInt::get(APInt(32, "3", 10)); - ConstantInt* const_int32_37 = ConstantInt::get(APInt(32, "4", 10)); - ConstantInt* const_int32_38 = ConstantInt::get(APInt(32, "-1", 10)); + Constant* const_int32_34 = Constant::getNullValue(IntegerType::get(32)); + UndefValue* const_packed_35 = UndefValue::get(VectorTy_1); + ConstantInt* const_int32_36 = ConstantInt::get(APInt(32, "1", 10)); + ConstantInt* const_int32_37 = ConstantInt::get(APInt(32, "2", 10)); + ConstantInt* const_int32_38 = ConstantInt::get(APInt(32, "3", 10)); + ConstantInt* const_int32_39 = ConstantInt::get(APInt(32, "4", 10)); + ConstantInt* const_int32_40 = ConstantInt::get(APInt(32, "-1", 10)); // Global Variable Definitions @@ -243,73 +255,73 @@ Module* createBaseShader() { BasicBlock* label_afterfor60 = new BasicBlock("afterfor60",func_from_array,0); // Block entry (label_entry) - ICmpInst* int1_cmp = new ICmpInst(ICmpInst::ICMP_SGT, int32_count, const_int32_32, "cmp", label_entry); - ICmpInst* int1_cmp5 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs, const_int32_32, "cmp5", label_entry); + ICmpInst* int1_cmp = new ICmpInst(ICmpInst::ICMP_SGT, int32_count, const_int32_34, "cmp", label_entry); + ICmpInst* int1_cmp5 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs, const_int32_34, "cmp5", label_entry); BinaryOperator* int1_bothcond = BinaryOperator::create(Instruction::And, int1_cmp, int1_cmp5, "bothcond", label_entry); new BranchInst(label_forbody6, label_afterfor60, int1_bothcond, label_entry); // Block forbody6 (label_forbody6) - Argument* fwdref_40 = new Argument(IntegerType::get(32)); - Argument* fwdref_41 = new Argument(IntegerType::get(32)); + Argument* fwdref_42 = new Argument(IntegerType::get(32)); + Argument* fwdref_43 = new Argument(IntegerType::get(32)); PHINode* int32_i_0_reg2mem_0 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody6); int32_i_0_reg2mem_0->reserveOperandSpace(3); - int32_i_0_reg2mem_0->addIncoming(const_int32_32, label_entry); - int32_i_0_reg2mem_0->addIncoming(fwdref_40, label_forinc57); - int32_i_0_reg2mem_0->addIncoming(fwdref_41, label_forbody6); + int32_i_0_reg2mem_0->addIncoming(const_int32_34, label_entry); + int32_i_0_reg2mem_0->addIncoming(fwdref_42, label_forinc57); + int32_i_0_reg2mem_0->addIncoming(fwdref_43, label_forbody6); - Argument* fwdref_42 = new Argument(IntegerType::get(32)); + Argument* fwdref_44 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0", label_forbody6); int32_j_0_reg2mem_0->reserveOperandSpace(3); - int32_j_0_reg2mem_0->addIncoming(fwdref_42, label_forbody6); - int32_j_0_reg2mem_0->addIncoming(const_int32_32, label_forinc57); - int32_j_0_reg2mem_0->addIncoming(const_int32_32, label_entry); + int32_j_0_reg2mem_0->addIncoming(fwdref_44, label_forbody6); + int32_j_0_reg2mem_0->addIncoming(const_int32_34, label_forinc57); + int32_j_0_reg2mem_0->addIncoming(const_int32_34, label_entry); - Argument* fwdref_43 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0 = new PHINode(VectorTy_13, "vec.0.reg2mem.0", label_forbody6); + Argument* fwdref_45 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody6); packed_vec_0_reg2mem_0->reserveOperandSpace(3); - packed_vec_0_reg2mem_0->addIncoming(fwdref_43, label_forbody6); - packed_vec_0_reg2mem_0->addIncoming(const_packed_33, label_entry); - packed_vec_0_reg2mem_0->addIncoming(fwdref_43, label_forinc57); + packed_vec_0_reg2mem_0->addIncoming(fwdref_45, label_forbody6); + packed_vec_0_reg2mem_0->addIncoming(const_packed_35, label_entry); + packed_vec_0_reg2mem_0->addIncoming(fwdref_45, label_forinc57); std::vector ptr_arraydecay11_indices; ptr_arraydecay11_indices.push_back(int32_i_0_reg2mem_0); ptr_arraydecay11_indices.push_back(int32_j_0_reg2mem_0); - ptr_arraydecay11_indices.push_back(const_int32_32); + ptr_arraydecay11_indices.push_back(const_int32_34); Instruction* ptr_arraydecay11 = new GetElementPtrInst(ptr_ainputs, ptr_arraydecay11_indices.begin(), ptr_arraydecay11_indices.end(), "arraydecay11", label_forbody6); LoadInst* float_tmp13 = new LoadInst(ptr_arraydecay11, "tmp13", false, label_forbody6); - InsertElementInst* packed_tmp15 = new InsertElementInst(packed_vec_0_reg2mem_0, float_tmp13, const_int32_32, "tmp15", label_forbody6); + InsertElementInst* packed_tmp15 = new InsertElementInst(packed_vec_0_reg2mem_0, float_tmp13, const_int32_34, "tmp15", label_forbody6); std::vector ptr_arrayidx23_indices; ptr_arrayidx23_indices.push_back(int32_i_0_reg2mem_0); ptr_arrayidx23_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx23_indices.push_back(const_int32_34); + ptr_arrayidx23_indices.push_back(const_int32_36); Instruction* ptr_arrayidx23 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx23_indices.begin(), ptr_arrayidx23_indices.end(), "arrayidx23", label_forbody6); LoadInst* float_tmp24 = new LoadInst(ptr_arrayidx23, "tmp24", false, label_forbody6); - InsertElementInst* packed_tmp26 = new InsertElementInst(packed_tmp15, float_tmp24, const_int32_34, "tmp26", label_forbody6); + InsertElementInst* packed_tmp26 = new InsertElementInst(packed_tmp15, float_tmp24, const_int32_36, "tmp26", label_forbody6); std::vector ptr_arrayidx34_indices; ptr_arrayidx34_indices.push_back(int32_i_0_reg2mem_0); ptr_arrayidx34_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx34_indices.push_back(const_int32_35); + ptr_arrayidx34_indices.push_back(const_int32_37); Instruction* ptr_arrayidx34 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx34_indices.begin(), ptr_arrayidx34_indices.end(), "arrayidx34", label_forbody6); LoadInst* float_tmp35 = new LoadInst(ptr_arrayidx34, "tmp35", false, label_forbody6); - InsertElementInst* packed_tmp37 = new InsertElementInst(packed_tmp26, float_tmp35, const_int32_35, "tmp37", label_forbody6); + InsertElementInst* packed_tmp37 = new InsertElementInst(packed_tmp26, float_tmp35, const_int32_37, "tmp37", label_forbody6); std::vector ptr_arrayidx45_indices; ptr_arrayidx45_indices.push_back(int32_i_0_reg2mem_0); ptr_arrayidx45_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx45_indices.push_back(const_int32_36); + ptr_arrayidx45_indices.push_back(const_int32_38); Instruction* ptr_arrayidx45 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx45_indices.begin(), ptr_arrayidx45_indices.end(), "arrayidx45", label_forbody6); LoadInst* float_tmp46 = new LoadInst(ptr_arrayidx45, "tmp46", false, label_forbody6); - InsertElementInst* packed_tmp48 = new InsertElementInst(packed_tmp37, float_tmp46, const_int32_36, "tmp48", label_forbody6); + InsertElementInst* packed_tmp48 = new InsertElementInst(packed_tmp37, float_tmp46, const_int32_38, "tmp48", label_forbody6); std::vector ptr_arrayidx54_indices; ptr_arrayidx54_indices.push_back(int32_i_0_reg2mem_0); ptr_arrayidx54_indices.push_back(int32_j_0_reg2mem_0); Instruction* ptr_arrayidx54 = new GetElementPtrInst(ptr_res, ptr_arrayidx54_indices.begin(), ptr_arrayidx54_indices.end(), "arrayidx54", label_forbody6); - StoreInst* void_44 = new StoreInst(packed_tmp48, ptr_arrayidx54, false, label_forbody6); - BinaryOperator* int32_inc = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0, const_int32_34, "inc", label_forbody6); + StoreInst* void_46 = new StoreInst(packed_tmp48, ptr_arrayidx54, false, label_forbody6); + BinaryOperator* int32_inc = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0, const_int32_36, "inc", label_forbody6); ICmpInst* int1_cmp59 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc, int32_num_attribs, "cmp59", label_forbody6); new BranchInst(label_forbody6, label_forinc57, int1_cmp59, label_forbody6); // Block forinc57 (label_forinc57) - BinaryOperator* int32_inc59 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0, const_int32_34, "inc59", label_forinc57); + BinaryOperator* int32_inc59 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0, const_int32_36, "inc59", label_forinc57); ICmpInst* int1_cmp17 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc59, int32_count, "cmp17", label_forinc57); new BranchInst(label_forbody6, label_afterfor60, int1_cmp17, label_forinc57); @@ -317,80 +329,80 @@ Module* createBaseShader() { new ReturnInst(label_afterfor60); // Resolve Forward References - fwdref_41->replaceAllUsesWith(int32_i_0_reg2mem_0); delete fwdref_41; - fwdref_43->replaceAllUsesWith(packed_tmp48); delete fwdref_43; - fwdref_42->replaceAllUsesWith(int32_inc); delete fwdref_42; - fwdref_40->replaceAllUsesWith(int32_inc59); delete fwdref_40; + fwdref_43->replaceAllUsesWith(int32_i_0_reg2mem_0); delete fwdref_43; + fwdref_45->replaceAllUsesWith(packed_tmp48); delete fwdref_45; + fwdref_44->replaceAllUsesWith(int32_inc); delete fwdref_44; + fwdref_42->replaceAllUsesWith(int32_inc59); delete fwdref_42; } // Function: from_consts (func_from_consts) { Function::arg_iterator args = func_from_consts->arg_begin(); - Value* ptr_res_48 = args++; - ptr_res_48->setName("res"); - Value* ptr_ainputs_49 = args++; - ptr_ainputs_49->setName("ainputs"); - Value* int32_count_50 = args++; - int32_count_50->setName("count"); - - BasicBlock* label_entry_51 = new BasicBlock("entry",func_from_consts,0); + Value* ptr_res_50 = args++; + ptr_res_50->setName("res"); + Value* ptr_ainputs_51 = args++; + ptr_ainputs_51->setName("ainputs"); + Value* int32_count_52 = args++; + int32_count_52->setName("count"); + + BasicBlock* label_entry_53 = new BasicBlock("entry",func_from_consts,0); BasicBlock* label_forbody = new BasicBlock("forbody",func_from_consts,0); BasicBlock* label_afterfor = new BasicBlock("afterfor",func_from_consts,0); - // Block entry (label_entry_51) - ICmpInst* int1_cmp_52 = new ICmpInst(ICmpInst::ICMP_SGT, int32_count_50, const_int32_32, "cmp", label_entry_51); - new BranchInst(label_forbody, label_afterfor, int1_cmp_52, label_entry_51); + // Block entry (label_entry_53) + ICmpInst* int1_cmp_54 = new ICmpInst(ICmpInst::ICMP_SGT, int32_count_52, const_int32_34, "cmp", label_entry_53); + new BranchInst(label_forbody, label_afterfor, int1_cmp_54, label_entry_53); // Block forbody (label_forbody) - Argument* fwdref_55 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_54 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody); - int32_i_0_reg2mem_0_54->reserveOperandSpace(2); - int32_i_0_reg2mem_0_54->addIncoming(const_int32_32, label_entry_51); - int32_i_0_reg2mem_0_54->addIncoming(fwdref_55, label_forbody); - - Argument* fwdref_57 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0_56 = new PHINode(VectorTy_13, "vec.0.reg2mem.0", label_forbody); - packed_vec_0_reg2mem_0_56->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_56->addIncoming(const_packed_33, label_entry_51); - packed_vec_0_reg2mem_0_56->addIncoming(fwdref_57, label_forbody); + Argument* fwdref_57 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_56 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody); + int32_i_0_reg2mem_0_56->reserveOperandSpace(2); + int32_i_0_reg2mem_0_56->addIncoming(const_int32_34, label_entry_53); + int32_i_0_reg2mem_0_56->addIncoming(fwdref_57, label_forbody); + + Argument* fwdref_59 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_58 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody); + packed_vec_0_reg2mem_0_58->reserveOperandSpace(2); + packed_vec_0_reg2mem_0_58->addIncoming(const_packed_35, label_entry_53); + packed_vec_0_reg2mem_0_58->addIncoming(fwdref_59, label_forbody); std::vector ptr_arraydecay_indices; - ptr_arraydecay_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arraydecay_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay = new GetElementPtrInst(ptr_ainputs_49, ptr_arraydecay_indices.begin(), ptr_arraydecay_indices.end(), "arraydecay", label_forbody); + ptr_arraydecay_indices.push_back(int32_i_0_reg2mem_0_56); + ptr_arraydecay_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay = new GetElementPtrInst(ptr_ainputs_51, ptr_arraydecay_indices.begin(), ptr_arraydecay_indices.end(), "arraydecay", label_forbody); LoadInst* float_tmp5 = new LoadInst(ptr_arraydecay, "tmp5", false, label_forbody); - InsertElementInst* packed_tmp7 = new InsertElementInst(packed_vec_0_reg2mem_0_56, float_tmp5, const_int32_32, "tmp7", label_forbody); + InsertElementInst* packed_tmp7 = new InsertElementInst(packed_vec_0_reg2mem_0_58, float_tmp5, const_int32_34, "tmp7", label_forbody); std::vector ptr_arrayidx12_indices; - ptr_arrayidx12_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx12_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx12 = new GetElementPtrInst(ptr_ainputs_49, ptr_arrayidx12_indices.begin(), ptr_arrayidx12_indices.end(), "arrayidx12", label_forbody); - LoadInst* float_tmp13_58 = new LoadInst(ptr_arrayidx12, "tmp13", false, label_forbody); - InsertElementInst* packed_tmp15_59 = new InsertElementInst(packed_tmp7, float_tmp13_58, const_int32_34, "tmp15", label_forbody); + ptr_arrayidx12_indices.push_back(int32_i_0_reg2mem_0_56); + ptr_arrayidx12_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx12 = new GetElementPtrInst(ptr_ainputs_51, ptr_arrayidx12_indices.begin(), ptr_arrayidx12_indices.end(), "arrayidx12", label_forbody); + LoadInst* float_tmp13_60 = new LoadInst(ptr_arrayidx12, "tmp13", false, label_forbody); + InsertElementInst* packed_tmp15_61 = new InsertElementInst(packed_tmp7, float_tmp13_60, const_int32_36, "tmp15", label_forbody); std::vector ptr_arrayidx20_indices; - ptr_arrayidx20_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx20_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx20 = new GetElementPtrInst(ptr_ainputs_49, ptr_arrayidx20_indices.begin(), ptr_arrayidx20_indices.end(), "arrayidx20", label_forbody); + ptr_arrayidx20_indices.push_back(int32_i_0_reg2mem_0_56); + ptr_arrayidx20_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx20 = new GetElementPtrInst(ptr_ainputs_51, ptr_arrayidx20_indices.begin(), ptr_arrayidx20_indices.end(), "arrayidx20", label_forbody); LoadInst* float_tmp21 = new LoadInst(ptr_arrayidx20, "tmp21", false, label_forbody); - InsertElementInst* packed_tmp23 = new InsertElementInst(packed_tmp15_59, float_tmp21, const_int32_35, "tmp23", label_forbody); + InsertElementInst* packed_tmp23 = new InsertElementInst(packed_tmp15_61, float_tmp21, const_int32_37, "tmp23", label_forbody); std::vector ptr_arrayidx28_indices; - ptr_arrayidx28_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx28_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx28 = new GetElementPtrInst(ptr_ainputs_49, ptr_arrayidx28_indices.begin(), ptr_arrayidx28_indices.end(), "arrayidx28", label_forbody); + ptr_arrayidx28_indices.push_back(int32_i_0_reg2mem_0_56); + ptr_arrayidx28_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx28 = new GetElementPtrInst(ptr_ainputs_51, ptr_arrayidx28_indices.begin(), ptr_arrayidx28_indices.end(), "arrayidx28", label_forbody); LoadInst* float_tmp29 = new LoadInst(ptr_arrayidx28, "tmp29", false, label_forbody); - InsertElementInst* packed_tmp31 = new InsertElementInst(packed_tmp23, float_tmp29, const_int32_36, "tmp31", label_forbody); - GetElementPtrInst* ptr_arrayidx34_60 = new GetElementPtrInst(ptr_res_48, int32_i_0_reg2mem_0_54, "arrayidx34", label_forbody); - StoreInst* void_61 = new StoreInst(packed_tmp31, ptr_arrayidx34_60, false, label_forbody); - BinaryOperator* int32_indvar_next = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_54, const_int32_34, "indvar.next", label_forbody); - ICmpInst* int1_exitcond = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next, int32_count_50, "exitcond", label_forbody); + InsertElementInst* packed_tmp31 = new InsertElementInst(packed_tmp23, float_tmp29, const_int32_38, "tmp31", label_forbody); + GetElementPtrInst* ptr_arrayidx34_62 = new GetElementPtrInst(ptr_res_50, int32_i_0_reg2mem_0_56, "arrayidx34", label_forbody); + StoreInst* void_63 = new StoreInst(packed_tmp31, ptr_arrayidx34_62, false, label_forbody); + BinaryOperator* int32_indvar_next = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_56, const_int32_36, "indvar.next", label_forbody); + ICmpInst* int1_exitcond = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next, int32_count_52, "exitcond", label_forbody); new BranchInst(label_afterfor, label_forbody, int1_exitcond, label_forbody); // Block afterfor (label_afterfor) new ReturnInst(label_afterfor); // Resolve Forward References - fwdref_57->replaceAllUsesWith(packed_tmp31); delete fwdref_57; - fwdref_55->replaceAllUsesWith(int32_indvar_next); delete fwdref_55; + fwdref_59->replaceAllUsesWith(packed_tmp31); delete fwdref_59; + fwdref_57->replaceAllUsesWith(int32_indvar_next); delete fwdref_57; } @@ -401,353 +413,363 @@ Module* createBaseShader() { ptr_dests->setName("dests"); Value* ptr_in = args++; ptr_in->setName("in"); - Value* int32_num_attribs_64 = args++; - int32_num_attribs_64->setName("num_attribs"); - - BasicBlock* label_entry_65 = new BasicBlock("entry",func_to_array,0); - BasicBlock* label_forbody_66 = new BasicBlock("forbody",func_to_array,0); - BasicBlock* label_afterfor_67 = new BasicBlock("afterfor",func_to_array,0); - - // Block entry (label_entry_65) - ICmpInst* int1_cmp_68 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_64, const_int32_32, "cmp", label_entry_65); - new BranchInst(label_forbody_66, label_afterfor_67, int1_cmp_68, label_entry_65); - - // Block forbody (label_forbody_66) - Argument* fwdref_71 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_70 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_66); - int32_i_0_reg2mem_0_70->reserveOperandSpace(2); - int32_i_0_reg2mem_0_70->addIncoming(const_int32_32, label_entry_65); - int32_i_0_reg2mem_0_70->addIncoming(fwdref_71, label_forbody_66); - - std::vector ptr_arraydecay_72_indices; - ptr_arraydecay_72_indices.push_back(int32_i_0_reg2mem_0_70); - ptr_arraydecay_72_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay_72 = new GetElementPtrInst(ptr_dests, ptr_arraydecay_72_indices.begin(), ptr_arraydecay_72_indices.end(), "arraydecay", label_forbody_66); - GetElementPtrInst* ptr_arrayidx6 = new GetElementPtrInst(ptr_in, int32_i_0_reg2mem_0_70, "arrayidx6", label_forbody_66); - LoadInst* packed_tmp7_73 = new LoadInst(ptr_arrayidx6, "tmp7", false, label_forbody_66); - ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp7_73, const_int32_32, "tmp11", label_forbody_66); - StoreInst* void_74 = new StoreInst(float_tmp11, ptr_arraydecay_72, false, label_forbody_66); + Value* int32_num_attribs_66 = args++; + int32_num_attribs_66->setName("num_attribs"); + + BasicBlock* label_entry_67 = new BasicBlock("entry",func_to_array,0); + BasicBlock* label_forbody_68 = new BasicBlock("forbody",func_to_array,0); + BasicBlock* label_afterfor_69 = new BasicBlock("afterfor",func_to_array,0); + + // Block entry (label_entry_67) + ICmpInst* int1_cmp_70 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_66, const_int32_34, "cmp", label_entry_67); + new BranchInst(label_forbody_68, label_afterfor_69, int1_cmp_70, label_entry_67); + + // Block forbody (label_forbody_68) + Argument* fwdref_73 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_72 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_68); + int32_i_0_reg2mem_0_72->reserveOperandSpace(2); + int32_i_0_reg2mem_0_72->addIncoming(const_int32_34, label_entry_67); + int32_i_0_reg2mem_0_72->addIncoming(fwdref_73, label_forbody_68); + + std::vector ptr_arraydecay_74_indices; + ptr_arraydecay_74_indices.push_back(int32_i_0_reg2mem_0_72); + ptr_arraydecay_74_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay_74 = new GetElementPtrInst(ptr_dests, ptr_arraydecay_74_indices.begin(), ptr_arraydecay_74_indices.end(), "arraydecay", label_forbody_68); + GetElementPtrInst* ptr_arrayidx6 = new GetElementPtrInst(ptr_in, int32_i_0_reg2mem_0_72, "arrayidx6", label_forbody_68); + LoadInst* packed_tmp7_75 = new LoadInst(ptr_arrayidx6, "tmp7", false, label_forbody_68); + ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp7_75, const_int32_34, "tmp11", label_forbody_68); + StoreInst* void_76 = new StoreInst(float_tmp11, ptr_arraydecay_74, false, label_forbody_68); std::vector ptr_arrayidx13_indices; - ptr_arrayidx13_indices.push_back(int32_i_0_reg2mem_0_70); - ptr_arrayidx13_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx13 = new GetElementPtrInst(ptr_dests, ptr_arrayidx13_indices.begin(), ptr_arrayidx13_indices.end(), "arrayidx13", label_forbody_66); - ExtractElementInst* float_tmp15 = new ExtractElementInst(packed_tmp7_73, const_int32_34, "tmp15", label_forbody_66); - StoreInst* void_75 = new StoreInst(float_tmp15, ptr_arrayidx13, false, label_forbody_66); + ptr_arrayidx13_indices.push_back(int32_i_0_reg2mem_0_72); + ptr_arrayidx13_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx13 = new GetElementPtrInst(ptr_dests, ptr_arrayidx13_indices.begin(), ptr_arrayidx13_indices.end(), "arrayidx13", label_forbody_68); + ExtractElementInst* float_tmp15 = new ExtractElementInst(packed_tmp7_75, const_int32_36, "tmp15", label_forbody_68); + StoreInst* void_77 = new StoreInst(float_tmp15, ptr_arrayidx13, false, label_forbody_68); std::vector ptr_arrayidx17_indices; - ptr_arrayidx17_indices.push_back(int32_i_0_reg2mem_0_70); - ptr_arrayidx17_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx17 = new GetElementPtrInst(ptr_dests, ptr_arrayidx17_indices.begin(), ptr_arrayidx17_indices.end(), "arrayidx17", label_forbody_66); - ExtractElementInst* float_tmp19 = new ExtractElementInst(packed_tmp7_73, const_int32_35, "tmp19", label_forbody_66); - StoreInst* void_76 = new StoreInst(float_tmp19, ptr_arrayidx17, false, label_forbody_66); + ptr_arrayidx17_indices.push_back(int32_i_0_reg2mem_0_72); + ptr_arrayidx17_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx17 = new GetElementPtrInst(ptr_dests, ptr_arrayidx17_indices.begin(), ptr_arrayidx17_indices.end(), "arrayidx17", label_forbody_68); + ExtractElementInst* float_tmp19 = new ExtractElementInst(packed_tmp7_75, const_int32_37, "tmp19", label_forbody_68); + StoreInst* void_78 = new StoreInst(float_tmp19, ptr_arrayidx17, false, label_forbody_68); std::vector ptr_arrayidx21_indices; - ptr_arrayidx21_indices.push_back(int32_i_0_reg2mem_0_70); - ptr_arrayidx21_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx21 = new GetElementPtrInst(ptr_dests, ptr_arrayidx21_indices.begin(), ptr_arrayidx21_indices.end(), "arrayidx21", label_forbody_66); - ExtractElementInst* float_tmp23 = new ExtractElementInst(packed_tmp7_73, const_int32_36, "tmp23", label_forbody_66); - StoreInst* void_77 = new StoreInst(float_tmp23, ptr_arrayidx21, false, label_forbody_66); - BinaryOperator* int32_indvar_next_78 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_70, const_int32_34, "indvar.next", label_forbody_66); - ICmpInst* int1_exitcond_79 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_78, int32_num_attribs_64, "exitcond", label_forbody_66); - new BranchInst(label_afterfor_67, label_forbody_66, int1_exitcond_79, label_forbody_66); - - // Block afterfor (label_afterfor_67) - new ReturnInst(label_afterfor_67); + ptr_arrayidx21_indices.push_back(int32_i_0_reg2mem_0_72); + ptr_arrayidx21_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx21 = new GetElementPtrInst(ptr_dests, ptr_arrayidx21_indices.begin(), ptr_arrayidx21_indices.end(), "arrayidx21", label_forbody_68); + ExtractElementInst* float_tmp23 = new ExtractElementInst(packed_tmp7_75, const_int32_38, "tmp23", label_forbody_68); + StoreInst* void_79 = new StoreInst(float_tmp23, ptr_arrayidx21, false, label_forbody_68); + BinaryOperator* int32_indvar_next_80 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_72, const_int32_36, "indvar.next", label_forbody_68); + ICmpInst* int1_exitcond_81 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_80, int32_num_attribs_66, "exitcond", label_forbody_68); + new BranchInst(label_afterfor_69, label_forbody_68, int1_exitcond_81, label_forbody_68); + + // Block afterfor (label_afterfor_69) + new ReturnInst(label_afterfor_69); // Resolve Forward References - fwdref_71->replaceAllUsesWith(int32_indvar_next_78); delete fwdref_71; + fwdref_73->replaceAllUsesWith(int32_indvar_next_80); delete fwdref_73; } // Function: run_vertex_shader (func_run_vertex_shader) { Function::arg_iterator args = func_run_vertex_shader->arg_begin(); - Value* ptr_ainputs_82 = args++; - ptr_ainputs_82->setName("ainputs"); - Value* ptr_dests_83 = args++; - ptr_dests_83->setName("dests"); + Value* ptr_ainputs_84 = args++; + ptr_ainputs_84->setName("ainputs"); + Value* ptr_dests_85 = args++; + ptr_dests_85->setName("dests"); Value* ptr_aconsts = args++; ptr_aconsts->setName("aconsts"); Value* int32_num_vertices = args++; int32_num_vertices->setName("num_vertices"); Value* int32_num_inputs = args++; int32_num_inputs->setName("num_inputs"); - Value* int32_num_attribs_84 = args++; - int32_num_attribs_84->setName("num_attribs"); + Value* int32_num_attribs_86 = args++; + int32_num_attribs_86->setName("num_attribs"); Value* int32_num_consts = args++; int32_num_consts->setName("num_consts"); - BasicBlock* label_entry_85 = new BasicBlock("entry",func_run_vertex_shader,0); + BasicBlock* label_entry_87 = new BasicBlock("entry",func_run_vertex_shader,0); BasicBlock* label_forbody6_i = new BasicBlock("forbody6.i",func_run_vertex_shader,0); BasicBlock* label_forinc57_i = new BasicBlock("forinc57.i",func_run_vertex_shader,0); BasicBlock* label_from_array_exit = new BasicBlock("from_array.exit",func_run_vertex_shader,0); BasicBlock* label_forbody_i15 = new BasicBlock("forbody.i15",func_run_vertex_shader,0); - BasicBlock* label_forcond = new BasicBlock("forcond",func_run_vertex_shader,0); + BasicBlock* label_from_consts_exit = new BasicBlock("from_consts.exit",func_run_vertex_shader,0); BasicBlock* label_forbody_preheader = new BasicBlock("forbody.preheader",func_run_vertex_shader,0); BasicBlock* label_forbody_us = new BasicBlock("forbody.us",func_run_vertex_shader,0); BasicBlock* label_to_array_exit_us = new BasicBlock("to_array.exit.us",func_run_vertex_shader,0); BasicBlock* label_forbody_i_us = new BasicBlock("forbody.i.us",func_run_vertex_shader,0); - BasicBlock* label_forbody_86 = new BasicBlock("forbody",func_run_vertex_shader,0); - BasicBlock* label_afterfor_87 = new BasicBlock("afterfor",func_run_vertex_shader,0); - - // Block entry (label_entry_85) - AllocaInst* ptr_inputs = new AllocaInst(ArrayTy_21, "inputs", label_entry_85); - AllocaInst* ptr_consts = new AllocaInst(ArrayTy_23, "consts", label_entry_85); - AllocaInst* ptr_results = new AllocaInst(ArrayTy_21, "results", label_entry_85); - AllocaInst* ptr_temps = new AllocaInst(ArrayTy_25, "temps", label_entry_85); - ICmpInst* int1_cmp_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_vertices, const_int32_32, "cmp.i", label_entry_85); - ICmpInst* int1_cmp5_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_inputs, const_int32_32, "cmp5.i", label_entry_85); - BinaryOperator* int1_bothcond_i = BinaryOperator::create(Instruction::And, int1_cmp5_i, int1_cmp_i, "bothcond.i", label_entry_85); - new BranchInst(label_forbody6_i, label_from_array_exit, int1_bothcond_i, label_entry_85); + BasicBlock* label_forbody_88 = new BasicBlock("forbody",func_run_vertex_shader,0); + BasicBlock* label_afterfor_89 = new BasicBlock("afterfor",func_run_vertex_shader,0); + + // Block entry (label_entry_87) + AllocaInst* ptr_inputs = new AllocaInst(ArrayTy_21, "inputs", label_entry_87); + AllocaInst* ptr_consts = new AllocaInst(ArrayTy_23, "consts", label_entry_87); + AllocaInst* ptr_results = new AllocaInst(ArrayTy_21, "results", label_entry_87); + AllocaInst* ptr_temps = new AllocaInst(ArrayTy_25, "temps", label_entry_87); + AllocaInst* ptr_args = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_87); + ICmpInst* int1_cmp_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_vertices, const_int32_34, "cmp.i", label_entry_87); + ICmpInst* int1_cmp5_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_inputs, const_int32_34, "cmp5.i", label_entry_87); + BinaryOperator* int1_bothcond_i = BinaryOperator::create(Instruction::And, int1_cmp5_i, int1_cmp_i, "bothcond.i", label_entry_87); + new BranchInst(label_forbody6_i, label_from_array_exit, int1_bothcond_i, label_entry_87); // Block forbody6.i (label_forbody6_i) - Argument* fwdref_89 = new Argument(IntegerType::get(32)); - Argument* fwdref_90 = new Argument(IntegerType::get(32)); + Argument* fwdref_91 = new Argument(IntegerType::get(32)); + Argument* fwdref_92 = new Argument(IntegerType::get(32)); PHINode* int32_i_0_reg2mem_0_i_ph = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i.ph", label_forbody6_i); int32_i_0_reg2mem_0_i_ph->reserveOperandSpace(3); - int32_i_0_reg2mem_0_i_ph->addIncoming(const_int32_32, label_entry_85); - int32_i_0_reg2mem_0_i_ph->addIncoming(fwdref_89, label_forinc57_i); - int32_i_0_reg2mem_0_i_ph->addIncoming(fwdref_90, label_forbody6_i); + int32_i_0_reg2mem_0_i_ph->addIncoming(const_int32_34, label_entry_87); + int32_i_0_reg2mem_0_i_ph->addIncoming(fwdref_91, label_forinc57_i); + int32_i_0_reg2mem_0_i_ph->addIncoming(fwdref_92, label_forbody6_i); - Argument* fwdref_91 = new Argument(IntegerType::get(32)); + Argument* fwdref_93 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0_i = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i", label_forbody6_i); int32_j_0_reg2mem_0_i->reserveOperandSpace(3); - int32_j_0_reg2mem_0_i->addIncoming(fwdref_91, label_forbody6_i); - int32_j_0_reg2mem_0_i->addIncoming(const_int32_32, label_forinc57_i); - int32_j_0_reg2mem_0_i->addIncoming(const_int32_32, label_entry_85); + int32_j_0_reg2mem_0_i->addIncoming(fwdref_93, label_forbody6_i); + int32_j_0_reg2mem_0_i->addIncoming(const_int32_34, label_forinc57_i); + int32_j_0_reg2mem_0_i->addIncoming(const_int32_34, label_entry_87); - Argument* fwdref_92 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0_i = new PHINode(VectorTy_13, "vec.0.reg2mem.0.i", label_forbody6_i); + Argument* fwdref_94 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody6_i); packed_vec_0_reg2mem_0_i->reserveOperandSpace(3); - packed_vec_0_reg2mem_0_i->addIncoming(fwdref_92, label_forbody6_i); - packed_vec_0_reg2mem_0_i->addIncoming(const_packed_33, label_entry_85); - packed_vec_0_reg2mem_0_i->addIncoming(fwdref_92, label_forinc57_i); + packed_vec_0_reg2mem_0_i->addIncoming(fwdref_94, label_forbody6_i); + packed_vec_0_reg2mem_0_i->addIncoming(const_packed_35, label_entry_87); + packed_vec_0_reg2mem_0_i->addIncoming(fwdref_94, label_forinc57_i); std::vector ptr_arraydecay11_i_indices; ptr_arraydecay11_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); ptr_arraydecay11_i_indices.push_back(int32_j_0_reg2mem_0_i); - ptr_arraydecay11_i_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay11_i = new GetElementPtrInst(ptr_ainputs_82, ptr_arraydecay11_i_indices.begin(), ptr_arraydecay11_i_indices.end(), "arraydecay11.i", label_forbody6_i); + ptr_arraydecay11_i_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay11_i = new GetElementPtrInst(ptr_ainputs_84, ptr_arraydecay11_i_indices.begin(), ptr_arraydecay11_i_indices.end(), "arraydecay11.i", label_forbody6_i); LoadInst* float_tmp13_i = new LoadInst(ptr_arraydecay11_i, "tmp13.i", false, label_forbody6_i); - InsertElementInst* packed_tmp15_i = new InsertElementInst(packed_vec_0_reg2mem_0_i, float_tmp13_i, const_int32_32, "tmp15.i", label_forbody6_i); + InsertElementInst* packed_tmp15_i = new InsertElementInst(packed_vec_0_reg2mem_0_i, float_tmp13_i, const_int32_34, "tmp15.i", label_forbody6_i); std::vector ptr_arrayidx23_i_indices; ptr_arrayidx23_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); ptr_arrayidx23_i_indices.push_back(int32_j_0_reg2mem_0_i); - ptr_arrayidx23_i_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx23_i = new GetElementPtrInst(ptr_ainputs_82, ptr_arrayidx23_i_indices.begin(), ptr_arrayidx23_i_indices.end(), "arrayidx23.i", label_forbody6_i); + ptr_arrayidx23_i_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx23_i = new GetElementPtrInst(ptr_ainputs_84, ptr_arrayidx23_i_indices.begin(), ptr_arrayidx23_i_indices.end(), "arrayidx23.i", label_forbody6_i); LoadInst* float_tmp24_i = new LoadInst(ptr_arrayidx23_i, "tmp24.i", false, label_forbody6_i); - InsertElementInst* packed_tmp26_i = new InsertElementInst(packed_tmp15_i, float_tmp24_i, const_int32_34, "tmp26.i", label_forbody6_i); + InsertElementInst* packed_tmp26_i = new InsertElementInst(packed_tmp15_i, float_tmp24_i, const_int32_36, "tmp26.i", label_forbody6_i); std::vector ptr_arrayidx34_i_indices; ptr_arrayidx34_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); ptr_arrayidx34_i_indices.push_back(int32_j_0_reg2mem_0_i); - ptr_arrayidx34_i_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx34_i = new GetElementPtrInst(ptr_ainputs_82, ptr_arrayidx34_i_indices.begin(), ptr_arrayidx34_i_indices.end(), "arrayidx34.i", label_forbody6_i); + ptr_arrayidx34_i_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx34_i = new GetElementPtrInst(ptr_ainputs_84, ptr_arrayidx34_i_indices.begin(), ptr_arrayidx34_i_indices.end(), "arrayidx34.i", label_forbody6_i); LoadInst* float_tmp35_i = new LoadInst(ptr_arrayidx34_i, "tmp35.i", false, label_forbody6_i); - InsertElementInst* packed_tmp37_i = new InsertElementInst(packed_tmp26_i, float_tmp35_i, const_int32_35, "tmp37.i", label_forbody6_i); + InsertElementInst* packed_tmp37_i = new InsertElementInst(packed_tmp26_i, float_tmp35_i, const_int32_37, "tmp37.i", label_forbody6_i); std::vector ptr_arrayidx45_i_indices; ptr_arrayidx45_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); ptr_arrayidx45_i_indices.push_back(int32_j_0_reg2mem_0_i); - ptr_arrayidx45_i_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx45_i = new GetElementPtrInst(ptr_ainputs_82, ptr_arrayidx45_i_indices.begin(), ptr_arrayidx45_i_indices.end(), "arrayidx45.i", label_forbody6_i); + ptr_arrayidx45_i_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx45_i = new GetElementPtrInst(ptr_ainputs_84, ptr_arrayidx45_i_indices.begin(), ptr_arrayidx45_i_indices.end(), "arrayidx45.i", label_forbody6_i); LoadInst* float_tmp46_i = new LoadInst(ptr_arrayidx45_i, "tmp46.i", false, label_forbody6_i); - InsertElementInst* packed_tmp48_i = new InsertElementInst(packed_tmp37_i, float_tmp46_i, const_int32_36, "tmp48.i", label_forbody6_i); + InsertElementInst* packed_tmp48_i = new InsertElementInst(packed_tmp37_i, float_tmp46_i, const_int32_38, "tmp48.i", label_forbody6_i); std::vector ptr_arrayidx54_i_indices; - ptr_arrayidx54_i_indices.push_back(const_int32_32); + ptr_arrayidx54_i_indices.push_back(const_int32_34); ptr_arrayidx54_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); ptr_arrayidx54_i_indices.push_back(int32_j_0_reg2mem_0_i); Instruction* ptr_arrayidx54_i = new GetElementPtrInst(ptr_inputs, ptr_arrayidx54_i_indices.begin(), ptr_arrayidx54_i_indices.end(), "arrayidx54.i", label_forbody6_i); - StoreInst* void_93 = new StoreInst(packed_tmp48_i, ptr_arrayidx54_i, false, label_forbody6_i); - BinaryOperator* int32_inc_i = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i, const_int32_34, "inc.i", label_forbody6_i); + StoreInst* void_95 = new StoreInst(packed_tmp48_i, ptr_arrayidx54_i, false, label_forbody6_i); + BinaryOperator* int32_inc_i = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i, const_int32_36, "inc.i", label_forbody6_i); ICmpInst* int1_cmp59_i = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i, int32_num_inputs, "cmp59.i", label_forbody6_i); new BranchInst(label_forbody6_i, label_forinc57_i, int1_cmp59_i, label_forbody6_i); // Block forinc57.i (label_forinc57_i) - BinaryOperator* int32_inc59_i = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i_ph, const_int32_34, "inc59.i", label_forinc57_i); + BinaryOperator* int32_inc59_i = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i_ph, const_int32_36, "inc59.i", label_forinc57_i); ICmpInst* int1_cmp17_i = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc59_i, int32_num_vertices, "cmp17.i", label_forinc57_i); new BranchInst(label_forbody6_i, label_from_array_exit, int1_cmp17_i, label_forinc57_i); // Block from_array.exit (label_from_array_exit) - ICmpInst* int1_cmp_i4 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts, const_int32_32, "cmp.i4", label_from_array_exit); - new BranchInst(label_forbody_i15, label_forcond, int1_cmp_i4, label_from_array_exit); + ICmpInst* int1_cmp_i4 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts, const_int32_34, "cmp.i4", label_from_array_exit); + new BranchInst(label_forbody_i15, label_from_consts_exit, int1_cmp_i4, label_from_array_exit); // Block forbody.i15 (label_forbody_i15) - Argument* fwdref_97 = new Argument(IntegerType::get(32)); + Argument* fwdref_99 = new Argument(IntegerType::get(32)); PHINode* int32_i_0_reg2mem_0_i5 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i5", label_forbody_i15); int32_i_0_reg2mem_0_i5->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i5->addIncoming(const_int32_32, label_from_array_exit); - int32_i_0_reg2mem_0_i5->addIncoming(fwdref_97, label_forbody_i15); + int32_i_0_reg2mem_0_i5->addIncoming(const_int32_34, label_from_array_exit); + int32_i_0_reg2mem_0_i5->addIncoming(fwdref_99, label_forbody_i15); - Argument* fwdref_98 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0_i6 = new PHINode(VectorTy_13, "vec.0.reg2mem.0.i6", label_forbody_i15); + Argument* fwdref_100 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i6 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i6", label_forbody_i15); packed_vec_0_reg2mem_0_i6->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i6->addIncoming(const_packed_33, label_from_array_exit); - packed_vec_0_reg2mem_0_i6->addIncoming(fwdref_98, label_forbody_i15); + packed_vec_0_reg2mem_0_i6->addIncoming(const_packed_35, label_from_array_exit); + packed_vec_0_reg2mem_0_i6->addIncoming(fwdref_100, label_forbody_i15); std::vector ptr_arraydecay_i7_indices; ptr_arraydecay_i7_indices.push_back(int32_i_0_reg2mem_0_i5); - ptr_arraydecay_i7_indices.push_back(const_int32_32); + ptr_arraydecay_i7_indices.push_back(const_int32_34); Instruction* ptr_arraydecay_i7 = new GetElementPtrInst(ptr_aconsts, ptr_arraydecay_i7_indices.begin(), ptr_arraydecay_i7_indices.end(), "arraydecay.i7", label_forbody_i15); LoadInst* float_tmp5_i = new LoadInst(ptr_arraydecay_i7, "tmp5.i", false, label_forbody_i15); - InsertElementInst* packed_tmp7_i8 = new InsertElementInst(packed_vec_0_reg2mem_0_i6, float_tmp5_i, const_int32_32, "tmp7.i8", label_forbody_i15); + InsertElementInst* packed_tmp7_i8 = new InsertElementInst(packed_vec_0_reg2mem_0_i6, float_tmp5_i, const_int32_34, "tmp7.i8", label_forbody_i15); std::vector ptr_arrayidx12_i_indices; ptr_arrayidx12_i_indices.push_back(int32_i_0_reg2mem_0_i5); - ptr_arrayidx12_i_indices.push_back(const_int32_34); + ptr_arrayidx12_i_indices.push_back(const_int32_36); Instruction* ptr_arrayidx12_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx12_i_indices.begin(), ptr_arrayidx12_i_indices.end(), "arrayidx12.i", label_forbody_i15); LoadInst* float_tmp13_i9 = new LoadInst(ptr_arrayidx12_i, "tmp13.i9", false, label_forbody_i15); - InsertElementInst* packed_tmp15_i10 = new InsertElementInst(packed_tmp7_i8, float_tmp13_i9, const_int32_34, "tmp15.i10", label_forbody_i15); + InsertElementInst* packed_tmp15_i10 = new InsertElementInst(packed_tmp7_i8, float_tmp13_i9, const_int32_36, "tmp15.i10", label_forbody_i15); std::vector ptr_arrayidx20_i_indices; ptr_arrayidx20_i_indices.push_back(int32_i_0_reg2mem_0_i5); - ptr_arrayidx20_i_indices.push_back(const_int32_35); + ptr_arrayidx20_i_indices.push_back(const_int32_37); Instruction* ptr_arrayidx20_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx20_i_indices.begin(), ptr_arrayidx20_i_indices.end(), "arrayidx20.i", label_forbody_i15); LoadInst* float_tmp21_i = new LoadInst(ptr_arrayidx20_i, "tmp21.i", false, label_forbody_i15); - InsertElementInst* packed_tmp23_i11 = new InsertElementInst(packed_tmp15_i10, float_tmp21_i, const_int32_35, "tmp23.i11", label_forbody_i15); + InsertElementInst* packed_tmp23_i11 = new InsertElementInst(packed_tmp15_i10, float_tmp21_i, const_int32_37, "tmp23.i11", label_forbody_i15); std::vector ptr_arrayidx28_i_indices; ptr_arrayidx28_i_indices.push_back(int32_i_0_reg2mem_0_i5); - ptr_arrayidx28_i_indices.push_back(const_int32_36); + ptr_arrayidx28_i_indices.push_back(const_int32_38); Instruction* ptr_arrayidx28_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx28_i_indices.begin(), ptr_arrayidx28_i_indices.end(), "arrayidx28.i", label_forbody_i15); LoadInst* float_tmp29_i = new LoadInst(ptr_arrayidx28_i, "tmp29.i", false, label_forbody_i15); - InsertElementInst* packed_tmp31_i = new InsertElementInst(packed_tmp23_i11, float_tmp29_i, const_int32_36, "tmp31.i", label_forbody_i15); + InsertElementInst* packed_tmp31_i = new InsertElementInst(packed_tmp23_i11, float_tmp29_i, const_int32_38, "tmp31.i", label_forbody_i15); std::vector ptr_arrayidx34_i12_indices; - ptr_arrayidx34_i12_indices.push_back(const_int32_32); + ptr_arrayidx34_i12_indices.push_back(const_int32_34); ptr_arrayidx34_i12_indices.push_back(int32_i_0_reg2mem_0_i5); Instruction* ptr_arrayidx34_i12 = new GetElementPtrInst(ptr_consts, ptr_arrayidx34_i12_indices.begin(), ptr_arrayidx34_i12_indices.end(), "arrayidx34.i12", label_forbody_i15); - StoreInst* void_99 = new StoreInst(packed_tmp31_i, ptr_arrayidx34_i12, false, label_forbody_i15); - BinaryOperator* int32_indvar_next24 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i5, const_int32_34, "indvar.next24", label_forbody_i15); + StoreInst* void_101 = new StoreInst(packed_tmp31_i, ptr_arrayidx34_i12, false, label_forbody_i15); + BinaryOperator* int32_indvar_next24 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i5, const_int32_36, "indvar.next24", label_forbody_i15); ICmpInst* int1_exitcond25 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next24, int32_num_consts, "exitcond25", label_forbody_i15); - new BranchInst(label_forcond, label_forbody_i15, int1_exitcond25, label_forbody_i15); - - // Block forcond (label_forcond) - new BranchInst(label_forbody_preheader, label_afterfor_87, int1_cmp_i, label_forcond); + new BranchInst(label_from_consts_exit, label_forbody_i15, int1_exitcond25, label_forbody_i15); + + // Block from_consts.exit (label_from_consts_exit) + std::vector ptr_tmp6_indices; + ptr_tmp6_indices.push_back(const_int32_34); + ptr_tmp6_indices.push_back(const_int32_38); + Instruction* ptr_tmp6 = new GetElementPtrInst(ptr_args, ptr_tmp6_indices.begin(), ptr_tmp6_indices.end(), "tmp6", label_from_consts_exit); + std::vector ptr_arraydecay7_indices; + ptr_arraydecay7_indices.push_back(const_int32_34); + ptr_arraydecay7_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay7 = new GetElementPtrInst(ptr_consts, ptr_arraydecay7_indices.begin(), ptr_arraydecay7_indices.end(), "arraydecay7", label_from_consts_exit); + StoreInst* void_103 = new StoreInst(ptr_arraydecay7, ptr_tmp6, false, label_from_consts_exit); + std::vector ptr_tmp8_indices; + ptr_tmp8_indices.push_back(const_int32_34); + ptr_tmp8_indices.push_back(const_int32_37); + Instruction* ptr_tmp8 = new GetElementPtrInst(ptr_args, ptr_tmp8_indices.begin(), ptr_tmp8_indices.end(), "tmp8", label_from_consts_exit); + std::vector ptr_arraydecay9_indices; + ptr_arraydecay9_indices.push_back(const_int32_34); + ptr_arraydecay9_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay9 = new GetElementPtrInst(ptr_temps, ptr_arraydecay9_indices.begin(), ptr_arraydecay9_indices.end(), "arraydecay9", label_from_consts_exit); + StoreInst* void_104 = new StoreInst(ptr_arraydecay9, ptr_tmp8, false, label_from_consts_exit); + new BranchInst(label_forbody_preheader, label_afterfor_89, int1_cmp_i, label_from_consts_exit); // Block forbody.preheader (label_forbody_preheader) - std::vector ptr_arraydecay17_indices; - ptr_arraydecay17_indices.push_back(const_int32_32); - ptr_arraydecay17_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay17 = new GetElementPtrInst(ptr_consts, ptr_arraydecay17_indices.begin(), ptr_arraydecay17_indices.end(), "arraydecay17", label_forbody_preheader); - std::vector ptr_arraydecay18_indices; - ptr_arraydecay18_indices.push_back(const_int32_32); - ptr_arraydecay18_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay18 = new GetElementPtrInst(ptr_temps, ptr_arraydecay18_indices.begin(), ptr_arraydecay18_indices.end(), "arraydecay18", label_forbody_preheader); - ICmpInst* int1_cmp_i1 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_84, const_int32_32, "cmp.i1", label_forbody_preheader); - new BranchInst(label_forbody_us, label_forbody_86, int1_cmp_i1, label_forbody_preheader); + std::vector ptr_tmp12_indices; + ptr_tmp12_indices.push_back(const_int32_34); + ptr_tmp12_indices.push_back(const_int32_34); + Instruction* ptr_tmp12 = new GetElementPtrInst(ptr_args, ptr_tmp12_indices.begin(), ptr_tmp12_indices.end(), "tmp12", label_forbody_preheader); + std::vector ptr_tmp16_indices; + ptr_tmp16_indices.push_back(const_int32_34); + ptr_tmp16_indices.push_back(const_int32_36); + Instruction* ptr_tmp16 = new GetElementPtrInst(ptr_args, ptr_tmp16_indices.begin(), ptr_tmp16_indices.end(), "tmp16", label_forbody_preheader); + ICmpInst* int1_cmp_i1 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_86, const_int32_34, "cmp.i1", label_forbody_preheader); + new BranchInst(label_forbody_us, label_forbody_88, int1_cmp_i1, label_forbody_preheader); // Block forbody.us (label_forbody_us) - Argument* fwdref_103 = new Argument(IntegerType::get(32)); + Argument* fwdref_107 = new Argument(IntegerType::get(32)); PHINode* int32_i_0_reg2mem_0_us = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.us", label_forbody_us); int32_i_0_reg2mem_0_us->reserveOperandSpace(2); - int32_i_0_reg2mem_0_us->addIncoming(const_int32_32, label_forbody_preheader); - int32_i_0_reg2mem_0_us->addIncoming(fwdref_103, label_to_array_exit_us); - - std::vector ptr_arraydecay10_us_indices; - ptr_arraydecay10_us_indices.push_back(const_int32_32); - ptr_arraydecay10_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arraydecay10_us_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay10_us = new GetElementPtrInst(ptr_inputs, ptr_arraydecay10_us_indices.begin(), ptr_arraydecay10_us_indices.end(), "arraydecay10.us", label_forbody_us); - std::vector ptr_arraydecay14_us_indices; - ptr_arraydecay14_us_indices.push_back(const_int32_32); - ptr_arraydecay14_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arraydecay14_us_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay14_us = new GetElementPtrInst(ptr_results, ptr_arraydecay14_us_indices.begin(), ptr_arraydecay14_us_indices.end(), "arraydecay14.us", label_forbody_us); - std::vector void_104_params; - void_104_params.push_back(ptr_arraydecay14_us); - void_104_params.push_back(ptr_arraydecay10_us); - void_104_params.push_back(ptr_arraydecay17); - void_104_params.push_back(ptr_arraydecay18); - CallInst* void_104 = new CallInst(func_execute_shader, void_104_params.begin(), void_104_params.end(), "", label_forbody_us); - void_104->setCallingConv(CallingConv::C); - void_104->setTailCall(false); + int32_i_0_reg2mem_0_us->addIncoming(const_int32_34, label_forbody_preheader); + int32_i_0_reg2mem_0_us->addIncoming(fwdref_107, label_to_array_exit_us); + + std::vector ptr_arraydecay15_us_indices; + ptr_arraydecay15_us_indices.push_back(const_int32_34); + ptr_arraydecay15_us_indices.push_back(int32_i_0_reg2mem_0_us); + ptr_arraydecay15_us_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay15_us = new GetElementPtrInst(ptr_results, ptr_arraydecay15_us_indices.begin(), ptr_arraydecay15_us_indices.end(), "arraydecay15.us", label_forbody_us); + StoreInst* void_108 = new StoreInst(ptr_arraydecay15_us, ptr_tmp12, false, label_forbody_us); + std::vector ptr_arraydecay20_us_indices; + ptr_arraydecay20_us_indices.push_back(const_int32_34); + ptr_arraydecay20_us_indices.push_back(int32_i_0_reg2mem_0_us); + ptr_arraydecay20_us_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay20_us = new GetElementPtrInst(ptr_inputs, ptr_arraydecay20_us_indices.begin(), ptr_arraydecay20_us_indices.end(), "arraydecay20.us", label_forbody_us); + StoreInst* void_109 = new StoreInst(ptr_arraydecay20_us, ptr_tmp16, false, label_forbody_us); + CallInst* void_110 = new CallInst(func_execute_shader, ptr_args, "", label_forbody_us); + void_110->setCallingConv(CallingConv::C); + void_110->setTailCall(false); + LoadInst* ptr_tmp26_us = new LoadInst(ptr_tmp12, "tmp26.us", false, label_forbody_us); new BranchInst(label_forbody_i_us, label_forbody_us); // Block to_array.exit.us (label_to_array_exit_us) - BinaryOperator* int32_inc_us = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_us, const_int32_34, "inc.us", label_to_array_exit_us); + BinaryOperator* int32_inc_us = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_us, const_int32_36, "inc.us", label_to_array_exit_us); ICmpInst* int1_cmp21_us = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_us, int32_num_vertices, "cmp21.us", label_to_array_exit_us); - new BranchInst(label_forbody_us, label_afterfor_87, int1_cmp21_us, label_to_array_exit_us); + new BranchInst(label_forbody_us, label_afterfor_89, int1_cmp21_us, label_to_array_exit_us); // Block forbody.i.us (label_forbody_i_us) - Argument* fwdref_107 = new Argument(IntegerType::get(32)); + Argument* fwdref_113 = new Argument(IntegerType::get(32)); PHINode* int32_i_0_reg2mem_0_i2_us = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i2.us", label_forbody_i_us); int32_i_0_reg2mem_0_i2_us->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i2_us->addIncoming(const_int32_32, label_forbody_us); - int32_i_0_reg2mem_0_i2_us->addIncoming(fwdref_107, label_forbody_i_us); + int32_i_0_reg2mem_0_i2_us->addIncoming(const_int32_34, label_forbody_us); + int32_i_0_reg2mem_0_i2_us->addIncoming(fwdref_113, label_forbody_i_us); std::vector ptr_arraydecay_i_us_indices; ptr_arraydecay_i_us_indices.push_back(int32_i_0_reg2mem_0_us); ptr_arraydecay_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - ptr_arraydecay_i_us_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay_i_us = new GetElementPtrInst(ptr_dests_83, ptr_arraydecay_i_us_indices.begin(), ptr_arraydecay_i_us_indices.end(), "arraydecay.i.us", label_forbody_i_us); - std::vector ptr_arrayidx6_i_us_indices; - ptr_arrayidx6_i_us_indices.push_back(const_int32_32); - ptr_arrayidx6_i_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arrayidx6_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - Instruction* ptr_arrayidx6_i_us = new GetElementPtrInst(ptr_results, ptr_arrayidx6_i_us_indices.begin(), ptr_arrayidx6_i_us_indices.end(), "arrayidx6.i.us", label_forbody_i_us); + ptr_arraydecay_i_us_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay_i_us = new GetElementPtrInst(ptr_dests_85, ptr_arraydecay_i_us_indices.begin(), ptr_arraydecay_i_us_indices.end(), "arraydecay.i.us", label_forbody_i_us); + GetElementPtrInst* ptr_arrayidx6_i_us = new GetElementPtrInst(ptr_tmp26_us, int32_i_0_reg2mem_0_i2_us, "arrayidx6.i.us", label_forbody_i_us); LoadInst* packed_tmp7_i_us = new LoadInst(ptr_arrayidx6_i_us, "tmp7.i.us", false, label_forbody_i_us); - ExtractElementInst* float_tmp11_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_32, "tmp11.i.us", label_forbody_i_us); - StoreInst* void_108 = new StoreInst(float_tmp11_i_us, ptr_arraydecay_i_us, false, label_forbody_i_us); + ExtractElementInst* float_tmp11_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_34, "tmp11.i.us", label_forbody_i_us); + StoreInst* void_114 = new StoreInst(float_tmp11_i_us, ptr_arraydecay_i_us, false, label_forbody_i_us); std::vector ptr_arrayidx13_i_us_indices; ptr_arrayidx13_i_us_indices.push_back(int32_i_0_reg2mem_0_us); ptr_arrayidx13_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - ptr_arrayidx13_i_us_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx13_i_us = new GetElementPtrInst(ptr_dests_83, ptr_arrayidx13_i_us_indices.begin(), ptr_arrayidx13_i_us_indices.end(), "arrayidx13.i.us", label_forbody_i_us); - ExtractElementInst* float_tmp15_i3_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_34, "tmp15.i3.us", label_forbody_i_us); - StoreInst* void_109 = new StoreInst(float_tmp15_i3_us, ptr_arrayidx13_i_us, false, label_forbody_i_us); + ptr_arrayidx13_i_us_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx13_i_us = new GetElementPtrInst(ptr_dests_85, ptr_arrayidx13_i_us_indices.begin(), ptr_arrayidx13_i_us_indices.end(), "arrayidx13.i.us", label_forbody_i_us); + ExtractElementInst* float_tmp15_i3_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_36, "tmp15.i3.us", label_forbody_i_us); + StoreInst* void_115 = new StoreInst(float_tmp15_i3_us, ptr_arrayidx13_i_us, false, label_forbody_i_us); std::vector ptr_arrayidx17_i_us_indices; ptr_arrayidx17_i_us_indices.push_back(int32_i_0_reg2mem_0_us); ptr_arrayidx17_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - ptr_arrayidx17_i_us_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx17_i_us = new GetElementPtrInst(ptr_dests_83, ptr_arrayidx17_i_us_indices.begin(), ptr_arrayidx17_i_us_indices.end(), "arrayidx17.i.us", label_forbody_i_us); - ExtractElementInst* float_tmp19_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_35, "tmp19.i.us", label_forbody_i_us); - StoreInst* void_110 = new StoreInst(float_tmp19_i_us, ptr_arrayidx17_i_us, false, label_forbody_i_us); + ptr_arrayidx17_i_us_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx17_i_us = new GetElementPtrInst(ptr_dests_85, ptr_arrayidx17_i_us_indices.begin(), ptr_arrayidx17_i_us_indices.end(), "arrayidx17.i.us", label_forbody_i_us); + ExtractElementInst* float_tmp19_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_37, "tmp19.i.us", label_forbody_i_us); + StoreInst* void_116 = new StoreInst(float_tmp19_i_us, ptr_arrayidx17_i_us, false, label_forbody_i_us); std::vector ptr_arrayidx21_i_us_indices; ptr_arrayidx21_i_us_indices.push_back(int32_i_0_reg2mem_0_us); ptr_arrayidx21_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - ptr_arrayidx21_i_us_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx21_i_us = new GetElementPtrInst(ptr_dests_83, ptr_arrayidx21_i_us_indices.begin(), ptr_arrayidx21_i_us_indices.end(), "arrayidx21.i.us", label_forbody_i_us); - ExtractElementInst* float_tmp23_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_36, "tmp23.i.us", label_forbody_i_us); - StoreInst* void_111 = new StoreInst(float_tmp23_i_us, ptr_arrayidx21_i_us, false, label_forbody_i_us); - BinaryOperator* int32_indvar_next_112 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i2_us, const_int32_34, "indvar.next", label_forbody_i_us); - ICmpInst* int1_exitcond_113 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_112, int32_num_attribs_84, "exitcond", label_forbody_i_us); - new BranchInst(label_to_array_exit_us, label_forbody_i_us, int1_exitcond_113, label_forbody_i_us); - - // Block forbody (label_forbody_86) - Argument* fwdref_116 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_115 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_86); - int32_i_0_reg2mem_0_115->reserveOperandSpace(2); - int32_i_0_reg2mem_0_115->addIncoming(const_int32_32, label_forbody_preheader); - int32_i_0_reg2mem_0_115->addIncoming(fwdref_116, label_forbody_86); - - std::vector ptr_arraydecay10_indices; - ptr_arraydecay10_indices.push_back(const_int32_32); - ptr_arraydecay10_indices.push_back(int32_i_0_reg2mem_0_115); - ptr_arraydecay10_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay10 = new GetElementPtrInst(ptr_inputs, ptr_arraydecay10_indices.begin(), ptr_arraydecay10_indices.end(), "arraydecay10", label_forbody_86); - std::vector ptr_arraydecay14_indices; - ptr_arraydecay14_indices.push_back(const_int32_32); - ptr_arraydecay14_indices.push_back(int32_i_0_reg2mem_0_115); - ptr_arraydecay14_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay14 = new GetElementPtrInst(ptr_results, ptr_arraydecay14_indices.begin(), ptr_arraydecay14_indices.end(), "arraydecay14", label_forbody_86); - std::vector void_117_params; - void_117_params.push_back(ptr_arraydecay14); - void_117_params.push_back(ptr_arraydecay10); - void_117_params.push_back(ptr_arraydecay17); - void_117_params.push_back(ptr_arraydecay18); - CallInst* void_117 = new CallInst(func_execute_shader, void_117_params.begin(), void_117_params.end(), "", label_forbody_86); - void_117->setCallingConv(CallingConv::C); - void_117->setTailCall(false); - BinaryOperator* int32_inc_118 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_115, const_int32_34, "inc", label_forbody_86); - ICmpInst* int1_cmp21 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_118, int32_num_vertices, "cmp21", label_forbody_86); - new BranchInst(label_forbody_86, label_afterfor_87, int1_cmp21, label_forbody_86); - - // Block afterfor (label_afterfor_87) - new ReturnInst(label_afterfor_87); + ptr_arrayidx21_i_us_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx21_i_us = new GetElementPtrInst(ptr_dests_85, ptr_arrayidx21_i_us_indices.begin(), ptr_arrayidx21_i_us_indices.end(), "arrayidx21.i.us", label_forbody_i_us); + ExtractElementInst* float_tmp23_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_38, "tmp23.i.us", label_forbody_i_us); + StoreInst* void_117 = new StoreInst(float_tmp23_i_us, ptr_arrayidx21_i_us, false, label_forbody_i_us); + BinaryOperator* int32_indvar_next_118 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i2_us, const_int32_36, "indvar.next", label_forbody_i_us); + ICmpInst* int1_exitcond_119 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_118, int32_num_attribs_86, "exitcond", label_forbody_i_us); + new BranchInst(label_to_array_exit_us, label_forbody_i_us, int1_exitcond_119, label_forbody_i_us); + + // Block forbody (label_forbody_88) + Argument* fwdref_122 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_121 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_88); + int32_i_0_reg2mem_0_121->reserveOperandSpace(2); + int32_i_0_reg2mem_0_121->addIncoming(const_int32_34, label_forbody_preheader); + int32_i_0_reg2mem_0_121->addIncoming(fwdref_122, label_forbody_88); + + std::vector ptr_arraydecay15_indices; + ptr_arraydecay15_indices.push_back(const_int32_34); + ptr_arraydecay15_indices.push_back(int32_i_0_reg2mem_0_121); + ptr_arraydecay15_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay15 = new GetElementPtrInst(ptr_results, ptr_arraydecay15_indices.begin(), ptr_arraydecay15_indices.end(), "arraydecay15", label_forbody_88); + StoreInst* void_123 = new StoreInst(ptr_arraydecay15, ptr_tmp12, false, label_forbody_88); + std::vector ptr_arraydecay20_indices; + ptr_arraydecay20_indices.push_back(const_int32_34); + ptr_arraydecay20_indices.push_back(int32_i_0_reg2mem_0_121); + ptr_arraydecay20_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay20 = new GetElementPtrInst(ptr_inputs, ptr_arraydecay20_indices.begin(), ptr_arraydecay20_indices.end(), "arraydecay20", label_forbody_88); + StoreInst* void_124 = new StoreInst(ptr_arraydecay20, ptr_tmp16, false, label_forbody_88); + CallInst* void_125 = new CallInst(func_execute_shader, ptr_args, "", label_forbody_88); + void_125->setCallingConv(CallingConv::C); + void_125->setTailCall(false); + BinaryOperator* int32_inc_126 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_121, const_int32_36, "inc", label_forbody_88); + ICmpInst* int1_cmp21 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_126, int32_num_vertices, "cmp21", label_forbody_88); + new BranchInst(label_forbody_88, label_afterfor_89, int1_cmp21, label_forbody_88); + + // Block afterfor (label_afterfor_89) + new ReturnInst(label_afterfor_89); // Resolve Forward References - fwdref_90->replaceAllUsesWith(int32_i_0_reg2mem_0_i_ph); delete fwdref_90; - fwdref_92->replaceAllUsesWith(packed_tmp48_i); delete fwdref_92; - fwdref_91->replaceAllUsesWith(int32_inc_i); delete fwdref_91; - fwdref_89->replaceAllUsesWith(int32_inc59_i); delete fwdref_89; - fwdref_98->replaceAllUsesWith(packed_tmp31_i); delete fwdref_98; - fwdref_97->replaceAllUsesWith(int32_indvar_next24); delete fwdref_97; - fwdref_103->replaceAllUsesWith(int32_inc_us); delete fwdref_103; - fwdref_107->replaceAllUsesWith(int32_indvar_next_112); delete fwdref_107; - fwdref_116->replaceAllUsesWith(int32_inc_118); delete fwdref_116; + fwdref_107->replaceAllUsesWith(int32_inc_us); delete fwdref_107; + fwdref_92->replaceAllUsesWith(int32_i_0_reg2mem_0_i_ph); delete fwdref_92; + fwdref_94->replaceAllUsesWith(packed_tmp48_i); delete fwdref_94; + fwdref_93->replaceAllUsesWith(int32_inc_i); delete fwdref_93; + fwdref_91->replaceAllUsesWith(int32_inc59_i); delete fwdref_91; + fwdref_100->replaceAllUsesWith(packed_tmp31_i); delete fwdref_100; + fwdref_99->replaceAllUsesWith(int32_indvar_next24); delete fwdref_99; + fwdref_113->replaceAllUsesWith(int32_indvar_next_118); delete fwdref_113; + fwdref_122->replaceAllUsesWith(int32_inc_126); delete fwdref_122; } @@ -758,410 +780,429 @@ Module* createBaseShader() { float_x->setName("x"); Value* float_y = args++; float_y->setName("y"); - Value* ptr_dests_121 = args++; - ptr_dests_121->setName("dests"); - Value* ptr_ainputs_122 = args++; - ptr_ainputs_122->setName("ainputs"); - Value* int32_num_inputs_123 = args++; - int32_num_inputs_123->setName("num_inputs"); - Value* ptr_aconsts_124 = args++; - ptr_aconsts_124->setName("aconsts"); - Value* int32_num_consts_125 = args++; - int32_num_consts_125->setName("num_consts"); + Value* ptr_dests_129 = args++; + ptr_dests_129->setName("dests"); + Value* ptr_ainputs_130 = args++; + ptr_ainputs_130->setName("ainputs"); + Value* int32_num_inputs_131 = args++; + int32_num_inputs_131->setName("num_inputs"); + Value* ptr_aconsts_132 = args++; + ptr_aconsts_132->setName("aconsts"); + Value* int32_num_consts_133 = args++; + int32_num_consts_133->setName("num_consts"); Value* ptr_samplers = args++; ptr_samplers->setName("samplers"); - BasicBlock* label_entry_126 = new BasicBlock("entry",func_run_fragment_shader,0); - BasicBlock* label_forbody6_i_127 = new BasicBlock("forbody6.i",func_run_fragment_shader,0); - BasicBlock* label_from_array_exit_128 = new BasicBlock("from_array.exit",func_run_fragment_shader,0); + BasicBlock* label_entry_134 = new BasicBlock("entry",func_run_fragment_shader,0); + BasicBlock* label_forbody6_i_135 = new BasicBlock("forbody6.i",func_run_fragment_shader,0); + BasicBlock* label_from_array_exit_136 = new BasicBlock("from_array.exit",func_run_fragment_shader,0); BasicBlock* label_forbody_i13 = new BasicBlock("forbody.i13",func_run_fragment_shader,0); - BasicBlock* label_forbody_preheader_129 = new BasicBlock("forbody.preheader",func_run_fragment_shader,0); - BasicBlock* label_forbody_130 = new BasicBlock("forbody",func_run_fragment_shader,0); - BasicBlock* label_afterfor_131 = new BasicBlock("afterfor",func_run_fragment_shader,0); + BasicBlock* label_from_consts_exit_137 = new BasicBlock("from_consts.exit",func_run_fragment_shader,0); + BasicBlock* label_forbody_138 = new BasicBlock("forbody",func_run_fragment_shader,0); + BasicBlock* label_afterfor_139 = new BasicBlock("afterfor",func_run_fragment_shader,0); BasicBlock* label_forbody6_i_1 = new BasicBlock("forbody6.i.1",func_run_fragment_shader,0); BasicBlock* label_forbody6_i_2 = new BasicBlock("forbody6.i.2",func_run_fragment_shader,0); BasicBlock* label_forbody6_i_3 = new BasicBlock("forbody6.i.3",func_run_fragment_shader,0); - // Block entry (label_entry_126) - AllocaInst* ptr_inputs_132 = new AllocaInst(ArrayTy_31, "inputs", label_entry_126); - AllocaInst* ptr_consts_133 = new AllocaInst(ArrayTy_23, "consts", label_entry_126); - AllocaInst* ptr_results_134 = new AllocaInst(ArrayTy_31, "results", label_entry_126); - AllocaInst* ptr_temps_135 = new AllocaInst(ArrayTy_25, "temps", label_entry_126); - ICmpInst* int1_cmp5_i_136 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_inputs_123, const_int32_32, "cmp5.i", label_entry_126); - new BranchInst(label_forbody6_i_127, label_from_array_exit_128, int1_cmp5_i_136, label_entry_126); - - // Block forbody6.i (label_forbody6_i_127) - Argument* fwdref_139 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0_i_138 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i", label_forbody6_i_127); - int32_j_0_reg2mem_0_i_138->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_138->addIncoming(const_int32_32, label_entry_126); - int32_j_0_reg2mem_0_i_138->addIncoming(fwdref_139, label_forbody6_i_127); - - Argument* fwdref_141 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0_i_140 = new PHINode(VectorTy_13, "vec.0.reg2mem.0.i", label_forbody6_i_127); - packed_vec_0_reg2mem_0_i_140->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_140->addIncoming(const_packed_33, label_entry_126); - packed_vec_0_reg2mem_0_i_140->addIncoming(fwdref_141, label_forbody6_i_127); - - std::vector ptr_arraydecay11_i_142_indices; - ptr_arraydecay11_i_142_indices.push_back(const_int32_32); - ptr_arraydecay11_i_142_indices.push_back(int32_j_0_reg2mem_0_i_138); - ptr_arraydecay11_i_142_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay11_i_142 = new GetElementPtrInst(ptr_ainputs_122, ptr_arraydecay11_i_142_indices.begin(), ptr_arraydecay11_i_142_indices.end(), "arraydecay11.i", label_forbody6_i_127); - LoadInst* float_tmp13_i_143 = new LoadInst(ptr_arraydecay11_i_142, "tmp13.i", false, label_forbody6_i_127); - InsertElementInst* packed_tmp15_i_144 = new InsertElementInst(packed_vec_0_reg2mem_0_i_140, float_tmp13_i_143, const_int32_32, "tmp15.i", label_forbody6_i_127); - std::vector ptr_arrayidx23_i_145_indices; - ptr_arrayidx23_i_145_indices.push_back(const_int32_32); - ptr_arrayidx23_i_145_indices.push_back(int32_j_0_reg2mem_0_i_138); - ptr_arrayidx23_i_145_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx23_i_145 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx23_i_145_indices.begin(), ptr_arrayidx23_i_145_indices.end(), "arrayidx23.i", label_forbody6_i_127); - LoadInst* float_tmp24_i_146 = new LoadInst(ptr_arrayidx23_i_145, "tmp24.i", false, label_forbody6_i_127); - InsertElementInst* packed_tmp26_i_147 = new InsertElementInst(packed_tmp15_i_144, float_tmp24_i_146, const_int32_34, "tmp26.i", label_forbody6_i_127); - std::vector ptr_arrayidx34_i_148_indices; - ptr_arrayidx34_i_148_indices.push_back(const_int32_32); - ptr_arrayidx34_i_148_indices.push_back(int32_j_0_reg2mem_0_i_138); - ptr_arrayidx34_i_148_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx34_i_148 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx34_i_148_indices.begin(), ptr_arrayidx34_i_148_indices.end(), "arrayidx34.i", label_forbody6_i_127); - LoadInst* float_tmp35_i_149 = new LoadInst(ptr_arrayidx34_i_148, "tmp35.i", false, label_forbody6_i_127); - InsertElementInst* packed_tmp37_i_150 = new InsertElementInst(packed_tmp26_i_147, float_tmp35_i_149, const_int32_35, "tmp37.i", label_forbody6_i_127); - std::vector ptr_arrayidx45_i_151_indices; - ptr_arrayidx45_i_151_indices.push_back(const_int32_32); - ptr_arrayidx45_i_151_indices.push_back(int32_j_0_reg2mem_0_i_138); - ptr_arrayidx45_i_151_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx45_i_151 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx45_i_151_indices.begin(), ptr_arrayidx45_i_151_indices.end(), "arrayidx45.i", label_forbody6_i_127); - LoadInst* float_tmp46_i_152 = new LoadInst(ptr_arrayidx45_i_151, "tmp46.i", false, label_forbody6_i_127); - InsertElementInst* packed_tmp48_i_153 = new InsertElementInst(packed_tmp37_i_150, float_tmp46_i_152, const_int32_36, "tmp48.i", label_forbody6_i_127); - std::vector ptr_arrayidx54_i_154_indices; - ptr_arrayidx54_i_154_indices.push_back(const_int32_32); - ptr_arrayidx54_i_154_indices.push_back(const_int32_32); - ptr_arrayidx54_i_154_indices.push_back(int32_j_0_reg2mem_0_i_138); - Instruction* ptr_arrayidx54_i_154 = new GetElementPtrInst(ptr_inputs_132, ptr_arrayidx54_i_154_indices.begin(), ptr_arrayidx54_i_154_indices.end(), "arrayidx54.i", label_forbody6_i_127); - StoreInst* void_155 = new StoreInst(packed_tmp48_i_153, ptr_arrayidx54_i_154, false, label_forbody6_i_127); - BinaryOperator* int32_inc_i_156 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_138, const_int32_34, "inc.i", label_forbody6_i_127); - ICmpInst* int1_cmp59_i_157 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_156, int32_num_inputs_123, "cmp59.i", label_forbody6_i_127); - new BranchInst(label_forbody6_i_127, label_forbody6_i_1, int1_cmp59_i_157, label_forbody6_i_127); - - // Block from_array.exit (label_from_array_exit_128) - ICmpInst* int1_cmp_i_159 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_125, const_int32_32, "cmp.i", label_from_array_exit_128); - new BranchInst(label_forbody_i13, label_forbody_preheader_129, int1_cmp_i_159, label_from_array_exit_128); + // Block entry (label_entry_134) + AllocaInst* ptr_inputs_140 = new AllocaInst(ArrayTy_33, "inputs", label_entry_134); + AllocaInst* ptr_consts_141 = new AllocaInst(ArrayTy_23, "consts", label_entry_134); + AllocaInst* ptr_results_142 = new AllocaInst(ArrayTy_33, "results", label_entry_134); + AllocaInst* ptr_temps_143 = new AllocaInst(ArrayTy_25, "temps", label_entry_134); + AllocaInst* ptr_args_144 = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_134); + ICmpInst* int1_cmp5_i_145 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_inputs_131, const_int32_34, "cmp5.i", label_entry_134); + new BranchInst(label_forbody6_i_135, label_from_array_exit_136, int1_cmp5_i_145, label_entry_134); + + // Block forbody6.i (label_forbody6_i_135) + Argument* fwdref_148 = new Argument(IntegerType::get(32)); + PHINode* int32_j_0_reg2mem_0_i_147 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i", label_forbody6_i_135); + int32_j_0_reg2mem_0_i_147->reserveOperandSpace(2); + int32_j_0_reg2mem_0_i_147->addIncoming(const_int32_34, label_entry_134); + int32_j_0_reg2mem_0_i_147->addIncoming(fwdref_148, label_forbody6_i_135); + + Argument* fwdref_150 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i_149 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody6_i_135); + packed_vec_0_reg2mem_0_i_149->reserveOperandSpace(2); + packed_vec_0_reg2mem_0_i_149->addIncoming(const_packed_35, label_entry_134); + packed_vec_0_reg2mem_0_i_149->addIncoming(fwdref_150, label_forbody6_i_135); + + std::vector ptr_arraydecay11_i_151_indices; + ptr_arraydecay11_i_151_indices.push_back(const_int32_34); + ptr_arraydecay11_i_151_indices.push_back(int32_j_0_reg2mem_0_i_147); + ptr_arraydecay11_i_151_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay11_i_151 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_151_indices.begin(), ptr_arraydecay11_i_151_indices.end(), "arraydecay11.i", label_forbody6_i_135); + LoadInst* float_tmp13_i_152 = new LoadInst(ptr_arraydecay11_i_151, "tmp13.i", false, label_forbody6_i_135); + InsertElementInst* packed_tmp15_i_153 = new InsertElementInst(packed_vec_0_reg2mem_0_i_149, float_tmp13_i_152, const_int32_34, "tmp15.i", label_forbody6_i_135); + std::vector ptr_arrayidx23_i_154_indices; + ptr_arrayidx23_i_154_indices.push_back(const_int32_34); + ptr_arrayidx23_i_154_indices.push_back(int32_j_0_reg2mem_0_i_147); + ptr_arrayidx23_i_154_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx23_i_154 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_154_indices.begin(), ptr_arrayidx23_i_154_indices.end(), "arrayidx23.i", label_forbody6_i_135); + LoadInst* float_tmp24_i_155 = new LoadInst(ptr_arrayidx23_i_154, "tmp24.i", false, label_forbody6_i_135); + InsertElementInst* packed_tmp26_i_156 = new InsertElementInst(packed_tmp15_i_153, float_tmp24_i_155, const_int32_36, "tmp26.i", label_forbody6_i_135); + std::vector ptr_arrayidx34_i_157_indices; + ptr_arrayidx34_i_157_indices.push_back(const_int32_34); + ptr_arrayidx34_i_157_indices.push_back(int32_j_0_reg2mem_0_i_147); + ptr_arrayidx34_i_157_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx34_i_157 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_157_indices.begin(), ptr_arrayidx34_i_157_indices.end(), "arrayidx34.i", label_forbody6_i_135); + LoadInst* float_tmp35_i_158 = new LoadInst(ptr_arrayidx34_i_157, "tmp35.i", false, label_forbody6_i_135); + InsertElementInst* packed_tmp37_i_159 = new InsertElementInst(packed_tmp26_i_156, float_tmp35_i_158, const_int32_37, "tmp37.i", label_forbody6_i_135); + std::vector ptr_arrayidx45_i_160_indices; + ptr_arrayidx45_i_160_indices.push_back(const_int32_34); + ptr_arrayidx45_i_160_indices.push_back(int32_j_0_reg2mem_0_i_147); + ptr_arrayidx45_i_160_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx45_i_160 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_160_indices.begin(), ptr_arrayidx45_i_160_indices.end(), "arrayidx45.i", label_forbody6_i_135); + LoadInst* float_tmp46_i_161 = new LoadInst(ptr_arrayidx45_i_160, "tmp46.i", false, label_forbody6_i_135); + InsertElementInst* packed_tmp48_i_162 = new InsertElementInst(packed_tmp37_i_159, float_tmp46_i_161, const_int32_38, "tmp48.i", label_forbody6_i_135); + std::vector ptr_arrayidx54_i_163_indices; + ptr_arrayidx54_i_163_indices.push_back(const_int32_34); + ptr_arrayidx54_i_163_indices.push_back(const_int32_34); + ptr_arrayidx54_i_163_indices.push_back(int32_j_0_reg2mem_0_i_147); + Instruction* ptr_arrayidx54_i_163 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_163_indices.begin(), ptr_arrayidx54_i_163_indices.end(), "arrayidx54.i", label_forbody6_i_135); + StoreInst* void_164 = new StoreInst(packed_tmp48_i_162, ptr_arrayidx54_i_163, false, label_forbody6_i_135); + BinaryOperator* int32_inc_i_165 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_147, const_int32_36, "inc.i", label_forbody6_i_135); + ICmpInst* int1_cmp59_i_166 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_165, int32_num_inputs_131, "cmp59.i", label_forbody6_i_135); + new BranchInst(label_forbody6_i_135, label_forbody6_i_1, int1_cmp59_i_166, label_forbody6_i_135); + + // Block from_array.exit (label_from_array_exit_136) + ICmpInst* int1_cmp_i_168 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_133, const_int32_34, "cmp.i", label_from_array_exit_136); + new BranchInst(label_forbody_i13, label_from_consts_exit_137, int1_cmp_i_168, label_from_array_exit_136); // Block forbody.i13 (label_forbody_i13) - Argument* fwdref_161 = new Argument(IntegerType::get(32)); + Argument* fwdref_170 = new Argument(IntegerType::get(32)); PHINode* int32_i_0_reg2mem_0_i3 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i3", label_forbody_i13); int32_i_0_reg2mem_0_i3->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i3->addIncoming(const_int32_32, label_from_array_exit_128); - int32_i_0_reg2mem_0_i3->addIncoming(fwdref_161, label_forbody_i13); + int32_i_0_reg2mem_0_i3->addIncoming(const_int32_34, label_from_array_exit_136); + int32_i_0_reg2mem_0_i3->addIncoming(fwdref_170, label_forbody_i13); - Argument* fwdref_162 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0_i4 = new PHINode(VectorTy_13, "vec.0.reg2mem.0.i4", label_forbody_i13); + Argument* fwdref_171 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i4 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i4", label_forbody_i13); packed_vec_0_reg2mem_0_i4->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i4->addIncoming(const_packed_33, label_from_array_exit_128); - packed_vec_0_reg2mem_0_i4->addIncoming(fwdref_162, label_forbody_i13); + packed_vec_0_reg2mem_0_i4->addIncoming(const_packed_35, label_from_array_exit_136); + packed_vec_0_reg2mem_0_i4->addIncoming(fwdref_171, label_forbody_i13); std::vector ptr_arraydecay_i5_indices; ptr_arraydecay_i5_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arraydecay_i5_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay_i5 = new GetElementPtrInst(ptr_aconsts_124, ptr_arraydecay_i5_indices.begin(), ptr_arraydecay_i5_indices.end(), "arraydecay.i5", label_forbody_i13); - LoadInst* float_tmp5_i_163 = new LoadInst(ptr_arraydecay_i5, "tmp5.i", false, label_forbody_i13); - InsertElementInst* packed_tmp7_i6 = new InsertElementInst(packed_vec_0_reg2mem_0_i4, float_tmp5_i_163, const_int32_32, "tmp7.i6", label_forbody_i13); - std::vector ptr_arrayidx12_i_164_indices; - ptr_arrayidx12_i_164_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx12_i_164_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx12_i_164 = new GetElementPtrInst(ptr_aconsts_124, ptr_arrayidx12_i_164_indices.begin(), ptr_arrayidx12_i_164_indices.end(), "arrayidx12.i", label_forbody_i13); - LoadInst* float_tmp13_i7 = new LoadInst(ptr_arrayidx12_i_164, "tmp13.i7", false, label_forbody_i13); - InsertElementInst* packed_tmp15_i8 = new InsertElementInst(packed_tmp7_i6, float_tmp13_i7, const_int32_34, "tmp15.i8", label_forbody_i13); - std::vector ptr_arrayidx20_i_165_indices; - ptr_arrayidx20_i_165_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx20_i_165_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx20_i_165 = new GetElementPtrInst(ptr_aconsts_124, ptr_arrayidx20_i_165_indices.begin(), ptr_arrayidx20_i_165_indices.end(), "arrayidx20.i", label_forbody_i13); - LoadInst* float_tmp21_i_166 = new LoadInst(ptr_arrayidx20_i_165, "tmp21.i", false, label_forbody_i13); - InsertElementInst* packed_tmp23_i9 = new InsertElementInst(packed_tmp15_i8, float_tmp21_i_166, const_int32_35, "tmp23.i9", label_forbody_i13); - std::vector ptr_arrayidx28_i_167_indices; - ptr_arrayidx28_i_167_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx28_i_167_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx28_i_167 = new GetElementPtrInst(ptr_aconsts_124, ptr_arrayidx28_i_167_indices.begin(), ptr_arrayidx28_i_167_indices.end(), "arrayidx28.i", label_forbody_i13); - LoadInst* float_tmp29_i_168 = new LoadInst(ptr_arrayidx28_i_167, "tmp29.i", false, label_forbody_i13); - InsertElementInst* packed_tmp31_i_169 = new InsertElementInst(packed_tmp23_i9, float_tmp29_i_168, const_int32_36, "tmp31.i", label_forbody_i13); + ptr_arraydecay_i5_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay_i5 = new GetElementPtrInst(ptr_aconsts_132, ptr_arraydecay_i5_indices.begin(), ptr_arraydecay_i5_indices.end(), "arraydecay.i5", label_forbody_i13); + LoadInst* float_tmp5_i_172 = new LoadInst(ptr_arraydecay_i5, "tmp5.i", false, label_forbody_i13); + InsertElementInst* packed_tmp7_i6 = new InsertElementInst(packed_vec_0_reg2mem_0_i4, float_tmp5_i_172, const_int32_34, "tmp7.i6", label_forbody_i13); + std::vector ptr_arrayidx12_i_173_indices; + ptr_arrayidx12_i_173_indices.push_back(int32_i_0_reg2mem_0_i3); + ptr_arrayidx12_i_173_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx12_i_173 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx12_i_173_indices.begin(), ptr_arrayidx12_i_173_indices.end(), "arrayidx12.i", label_forbody_i13); + LoadInst* float_tmp13_i7 = new LoadInst(ptr_arrayidx12_i_173, "tmp13.i7", false, label_forbody_i13); + InsertElementInst* packed_tmp15_i8 = new InsertElementInst(packed_tmp7_i6, float_tmp13_i7, const_int32_36, "tmp15.i8", label_forbody_i13); + std::vector ptr_arrayidx20_i_174_indices; + ptr_arrayidx20_i_174_indices.push_back(int32_i_0_reg2mem_0_i3); + ptr_arrayidx20_i_174_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx20_i_174 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx20_i_174_indices.begin(), ptr_arrayidx20_i_174_indices.end(), "arrayidx20.i", label_forbody_i13); + LoadInst* float_tmp21_i_175 = new LoadInst(ptr_arrayidx20_i_174, "tmp21.i", false, label_forbody_i13); + InsertElementInst* packed_tmp23_i9 = new InsertElementInst(packed_tmp15_i8, float_tmp21_i_175, const_int32_37, "tmp23.i9", label_forbody_i13); + std::vector ptr_arrayidx28_i_176_indices; + ptr_arrayidx28_i_176_indices.push_back(int32_i_0_reg2mem_0_i3); + ptr_arrayidx28_i_176_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx28_i_176 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx28_i_176_indices.begin(), ptr_arrayidx28_i_176_indices.end(), "arrayidx28.i", label_forbody_i13); + LoadInst* float_tmp29_i_177 = new LoadInst(ptr_arrayidx28_i_176, "tmp29.i", false, label_forbody_i13); + InsertElementInst* packed_tmp31_i_178 = new InsertElementInst(packed_tmp23_i9, float_tmp29_i_177, const_int32_38, "tmp31.i", label_forbody_i13); std::vector ptr_arrayidx34_i10_indices; - ptr_arrayidx34_i10_indices.push_back(const_int32_32); + ptr_arrayidx34_i10_indices.push_back(const_int32_34); ptr_arrayidx34_i10_indices.push_back(int32_i_0_reg2mem_0_i3); - Instruction* ptr_arrayidx34_i10 = new GetElementPtrInst(ptr_consts_133, ptr_arrayidx34_i10_indices.begin(), ptr_arrayidx34_i10_indices.end(), "arrayidx34.i10", label_forbody_i13); - StoreInst* void_170 = new StoreInst(packed_tmp31_i_169, ptr_arrayidx34_i10, false, label_forbody_i13); - BinaryOperator* int32_indvar_next22 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i3, const_int32_34, "indvar.next22", label_forbody_i13); - ICmpInst* int1_exitcond23 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next22, int32_num_consts_125, "exitcond23", label_forbody_i13); - new BranchInst(label_forbody_preheader_129, label_forbody_i13, int1_exitcond23, label_forbody_i13); - - // Block forbody.preheader (label_forbody_preheader_129) - std::vector ptr_arraydecay15_indices; - ptr_arraydecay15_indices.push_back(const_int32_32); - ptr_arraydecay15_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay15 = new GetElementPtrInst(ptr_consts_133, ptr_arraydecay15_indices.begin(), ptr_arraydecay15_indices.end(), "arraydecay15", label_forbody_preheader_129); - std::vector ptr_arraydecay16_indices; - ptr_arraydecay16_indices.push_back(const_int32_32); - ptr_arraydecay16_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay16 = new GetElementPtrInst(ptr_temps_135, ptr_arraydecay16_indices.begin(), ptr_arraydecay16_indices.end(), "arraydecay16", label_forbody_preheader_129); - new BranchInst(label_forbody_130, label_forbody_preheader_129); - - // Block forbody (label_forbody_130) - Argument* fwdref_174 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_173 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_130); - int32_i_0_reg2mem_0_173->reserveOperandSpace(2); - int32_i_0_reg2mem_0_173->addIncoming(const_int32_32, label_forbody_preheader_129); - int32_i_0_reg2mem_0_173->addIncoming(fwdref_174, label_forbody_130); - + Instruction* ptr_arrayidx34_i10 = new GetElementPtrInst(ptr_consts_141, ptr_arrayidx34_i10_indices.begin(), ptr_arrayidx34_i10_indices.end(), "arrayidx34.i10", label_forbody_i13); + StoreInst* void_179 = new StoreInst(packed_tmp31_i_178, ptr_arrayidx34_i10, false, label_forbody_i13); + BinaryOperator* int32_indvar_next22 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i3, const_int32_36, "indvar.next22", label_forbody_i13); + ICmpInst* int1_exitcond23 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next22, int32_num_consts_133, "exitcond23", label_forbody_i13); + new BranchInst(label_from_consts_exit_137, label_forbody_i13, int1_exitcond23, label_forbody_i13); + + // Block from_consts.exit (label_from_consts_exit_137) + std::vector ptr_tmp5_indices; + ptr_tmp5_indices.push_back(const_int32_34); + ptr_tmp5_indices.push_back(const_int32_38); + Instruction* ptr_tmp5 = new GetElementPtrInst(ptr_args_144, ptr_tmp5_indices.begin(), ptr_tmp5_indices.end(), "tmp5", label_from_consts_exit_137); + std::vector ptr_arraydecay6_indices; + ptr_arraydecay6_indices.push_back(const_int32_34); + ptr_arraydecay6_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay6 = new GetElementPtrInst(ptr_consts_141, ptr_arraydecay6_indices.begin(), ptr_arraydecay6_indices.end(), "arraydecay6", label_from_consts_exit_137); + StoreInst* void_181 = new StoreInst(ptr_arraydecay6, ptr_tmp5, false, label_from_consts_exit_137); + std::vector ptr_tmp7_indices; + ptr_tmp7_indices.push_back(const_int32_34); + ptr_tmp7_indices.push_back(const_int32_37); + Instruction* ptr_tmp7 = new GetElementPtrInst(ptr_args_144, ptr_tmp7_indices.begin(), ptr_tmp7_indices.end(), "tmp7", label_from_consts_exit_137); std::vector ptr_arraydecay8_indices; - ptr_arraydecay8_indices.push_back(const_int32_32); - ptr_arraydecay8_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arraydecay8_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay8 = new GetElementPtrInst(ptr_inputs_132, ptr_arraydecay8_indices.begin(), ptr_arraydecay8_indices.end(), "arraydecay8", label_forbody_130); - std::vector ptr_arraydecay12_indices; - ptr_arraydecay12_indices.push_back(const_int32_32); - ptr_arraydecay12_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arraydecay12_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay12 = new GetElementPtrInst(ptr_results_134, ptr_arraydecay12_indices.begin(), ptr_arraydecay12_indices.end(), "arraydecay12", label_forbody_130); - std::vector void_175_params; - void_175_params.push_back(ptr_arraydecay12); - void_175_params.push_back(ptr_arraydecay8); - void_175_params.push_back(ptr_arraydecay15); - void_175_params.push_back(ptr_arraydecay16); - CallInst* void_175 = new CallInst(func_execute_shader, void_175_params.begin(), void_175_params.end(), "", label_forbody_130); - void_175->setCallingConv(CallingConv::C); - void_175->setTailCall(false); + ptr_arraydecay8_indices.push_back(const_int32_34); + ptr_arraydecay8_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay8 = new GetElementPtrInst(ptr_temps_143, ptr_arraydecay8_indices.begin(), ptr_arraydecay8_indices.end(), "arraydecay8", label_from_consts_exit_137); + StoreInst* void_182 = new StoreInst(ptr_arraydecay8, ptr_tmp7, false, label_from_consts_exit_137); + std::vector ptr_tmp10_indices; + ptr_tmp10_indices.push_back(const_int32_34); + ptr_tmp10_indices.push_back(const_int32_36); + Instruction* ptr_tmp10 = new GetElementPtrInst(ptr_args_144, ptr_tmp10_indices.begin(), ptr_tmp10_indices.end(), "tmp10", label_from_consts_exit_137); + std::vector ptr_tmp14_indices; + ptr_tmp14_indices.push_back(const_int32_34); + ptr_tmp14_indices.push_back(const_int32_34); + Instruction* ptr_tmp14 = new GetElementPtrInst(ptr_args_144, ptr_tmp14_indices.begin(), ptr_tmp14_indices.end(), "tmp14", label_from_consts_exit_137); + new BranchInst(label_forbody_138, label_from_consts_exit_137); + + // Block forbody (label_forbody_138) + Argument* fwdref_185 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_184 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_138); + int32_i_0_reg2mem_0_184->reserveOperandSpace(2); + int32_i_0_reg2mem_0_184->addIncoming(const_int32_34, label_from_consts_exit_137); + int32_i_0_reg2mem_0_184->addIncoming(fwdref_185, label_forbody_138); + + std::vector ptr_arraydecay13_indices; + ptr_arraydecay13_indices.push_back(const_int32_34); + ptr_arraydecay13_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arraydecay13_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay13 = new GetElementPtrInst(ptr_inputs_140, ptr_arraydecay13_indices.begin(), ptr_arraydecay13_indices.end(), "arraydecay13", label_forbody_138); + StoreInst* void_186 = new StoreInst(ptr_arraydecay13, ptr_tmp10, false, label_forbody_138); + std::vector ptr_arraydecay18_indices; + ptr_arraydecay18_indices.push_back(const_int32_34); + ptr_arraydecay18_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arraydecay18_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay18 = new GetElementPtrInst(ptr_results_142, ptr_arraydecay18_indices.begin(), ptr_arraydecay18_indices.end(), "arraydecay18", label_forbody_138); + StoreInst* void_187 = new StoreInst(ptr_arraydecay18, ptr_tmp14, false, label_forbody_138); + CallInst* void_188 = new CallInst(func_execute_shader, ptr_args_144, "", label_forbody_138); + void_188->setCallingConv(CallingConv::C); + void_188->setTailCall(false); + LoadInst* ptr_tmp24 = new LoadInst(ptr_tmp14, "tmp24", false, label_forbody_138); std::vector ptr_arraydecay_i_indices; - ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arraydecay_i_indices.push_back(const_int32_32); - ptr_arraydecay_i_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay_i = new GetElementPtrInst(ptr_dests_121, ptr_arraydecay_i_indices.begin(), ptr_arraydecay_i_indices.end(), "arraydecay.i", label_forbody_130); - LoadInst* packed_tmp7_i = new LoadInst(ptr_arraydecay12, "tmp7.i", false, label_forbody_130); - ExtractElementInst* float_tmp11_i = new ExtractElementInst(packed_tmp7_i, const_int32_32, "tmp11.i", label_forbody_130); - StoreInst* void_176 = new StoreInst(float_tmp11_i, ptr_arraydecay_i, false, label_forbody_130); + ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arraydecay_i_indices.push_back(const_int32_34); + ptr_arraydecay_i_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay_i = new GetElementPtrInst(ptr_dests_129, ptr_arraydecay_i_indices.begin(), ptr_arraydecay_i_indices.end(), "arraydecay.i", label_forbody_138); + LoadInst* packed_tmp7_i = new LoadInst(ptr_tmp24, "tmp7.i", false, label_forbody_138); + ExtractElementInst* float_tmp11_i = new ExtractElementInst(packed_tmp7_i, const_int32_34, "tmp11.i", label_forbody_138); + StoreInst* void_189 = new StoreInst(float_tmp11_i, ptr_arraydecay_i, false, label_forbody_138); std::vector ptr_arrayidx13_i_indices; - ptr_arrayidx13_i_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arrayidx13_i_indices.push_back(const_int32_32); + ptr_arrayidx13_i_indices.push_back(int32_i_0_reg2mem_0_184); ptr_arrayidx13_i_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx13_i = new GetElementPtrInst(ptr_dests_121, ptr_arrayidx13_i_indices.begin(), ptr_arrayidx13_i_indices.end(), "arrayidx13.i", label_forbody_130); - ExtractElementInst* float_tmp15_i2 = new ExtractElementInst(packed_tmp7_i, const_int32_34, "tmp15.i2", label_forbody_130); - StoreInst* void_177 = new StoreInst(float_tmp15_i2, ptr_arrayidx13_i, false, label_forbody_130); + ptr_arrayidx13_i_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx13_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx13_i_indices.begin(), ptr_arrayidx13_i_indices.end(), "arrayidx13.i", label_forbody_138); + ExtractElementInst* float_tmp15_i2 = new ExtractElementInst(packed_tmp7_i, const_int32_36, "tmp15.i2", label_forbody_138); + StoreInst* void_190 = new StoreInst(float_tmp15_i2, ptr_arrayidx13_i, false, label_forbody_138); std::vector ptr_arrayidx17_i_indices; - ptr_arrayidx17_i_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arrayidx17_i_indices.push_back(const_int32_32); - ptr_arrayidx17_i_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx17_i = new GetElementPtrInst(ptr_dests_121, ptr_arrayidx17_i_indices.begin(), ptr_arrayidx17_i_indices.end(), "arrayidx17.i", label_forbody_130); - ExtractElementInst* float_tmp19_i = new ExtractElementInst(packed_tmp7_i, const_int32_35, "tmp19.i", label_forbody_130); - StoreInst* void_178 = new StoreInst(float_tmp19_i, ptr_arrayidx17_i, false, label_forbody_130); + ptr_arrayidx17_i_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx17_i_indices.push_back(const_int32_34); + ptr_arrayidx17_i_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx17_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx17_i_indices.begin(), ptr_arrayidx17_i_indices.end(), "arrayidx17.i", label_forbody_138); + ExtractElementInst* float_tmp19_i = new ExtractElementInst(packed_tmp7_i, const_int32_37, "tmp19.i", label_forbody_138); + StoreInst* void_191 = new StoreInst(float_tmp19_i, ptr_arrayidx17_i, false, label_forbody_138); std::vector ptr_arrayidx21_i_indices; - ptr_arrayidx21_i_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arrayidx21_i_indices.push_back(const_int32_32); - ptr_arrayidx21_i_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx21_i = new GetElementPtrInst(ptr_dests_121, ptr_arrayidx21_i_indices.begin(), ptr_arrayidx21_i_indices.end(), "arrayidx21.i", label_forbody_130); - ExtractElementInst* float_tmp23_i = new ExtractElementInst(packed_tmp7_i, const_int32_36, "tmp23.i", label_forbody_130); - StoreInst* void_179 = new StoreInst(float_tmp23_i, ptr_arrayidx21_i, false, label_forbody_130); + ptr_arrayidx21_i_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx21_i_indices.push_back(const_int32_34); + ptr_arrayidx21_i_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx21_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx21_i_indices.begin(), ptr_arrayidx21_i_indices.end(), "arrayidx21.i", label_forbody_138); + ExtractElementInst* float_tmp23_i = new ExtractElementInst(packed_tmp7_i, const_int32_38, "tmp23.i", label_forbody_138); + StoreInst* void_192 = new StoreInst(float_tmp23_i, ptr_arrayidx21_i, false, label_forbody_138); std::vector ptr_arraydecay_i_1_indices; - ptr_arraydecay_i_1_indices.push_back(int32_i_0_reg2mem_0_173); + ptr_arraydecay_i_1_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arraydecay_i_1_indices.push_back(const_int32_36); ptr_arraydecay_i_1_indices.push_back(const_int32_34); - ptr_arraydecay_i_1_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay_i_1 = new GetElementPtrInst(ptr_dests_121, ptr_arraydecay_i_1_indices.begin(), ptr_arraydecay_i_1_indices.end(), "arraydecay.i.1", label_forbody_130); - std::vector ptr_arrayidx6_i_1_indices; - ptr_arrayidx6_i_1_indices.push_back(const_int32_32); - ptr_arrayidx6_i_1_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arrayidx6_i_1_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx6_i_1 = new GetElementPtrInst(ptr_results_134, ptr_arrayidx6_i_1_indices.begin(), ptr_arrayidx6_i_1_indices.end(), "arrayidx6.i.1", label_forbody_130); - LoadInst* packed_tmp7_i_1 = new LoadInst(ptr_arrayidx6_i_1, "tmp7.i.1", false, label_forbody_130); - ExtractElementInst* float_tmp11_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_32, "tmp11.i.1", label_forbody_130); - StoreInst* void_180 = new StoreInst(float_tmp11_i_1, ptr_arraydecay_i_1, false, label_forbody_130); + Instruction* ptr_arraydecay_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arraydecay_i_1_indices.begin(), ptr_arraydecay_i_1_indices.end(), "arraydecay.i.1", label_forbody_138); + GetElementPtrInst* ptr_arrayidx6_i_1 = new GetElementPtrInst(ptr_tmp24, const_int32_36, "arrayidx6.i.1", label_forbody_138); + LoadInst* packed_tmp7_i_1 = new LoadInst(ptr_arrayidx6_i_1, "tmp7.i.1", false, label_forbody_138); + ExtractElementInst* float_tmp11_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_34, "tmp11.i.1", label_forbody_138); + StoreInst* void_193 = new StoreInst(float_tmp11_i_1, ptr_arraydecay_i_1, false, label_forbody_138); std::vector ptr_arrayidx13_i_1_indices; - ptr_arrayidx13_i_1_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arrayidx13_i_1_indices.push_back(const_int32_34); - ptr_arrayidx13_i_1_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx13_i_1 = new GetElementPtrInst(ptr_dests_121, ptr_arrayidx13_i_1_indices.begin(), ptr_arrayidx13_i_1_indices.end(), "arrayidx13.i.1", label_forbody_130); - ExtractElementInst* float_tmp15_i2_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_34, "tmp15.i2.1", label_forbody_130); - StoreInst* void_181 = new StoreInst(float_tmp15_i2_1, ptr_arrayidx13_i_1, false, label_forbody_130); + ptr_arrayidx13_i_1_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx13_i_1_indices.push_back(const_int32_36); + ptr_arrayidx13_i_1_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx13_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx13_i_1_indices.begin(), ptr_arrayidx13_i_1_indices.end(), "arrayidx13.i.1", label_forbody_138); + ExtractElementInst* float_tmp15_i2_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_36, "tmp15.i2.1", label_forbody_138); + StoreInst* void_194 = new StoreInst(float_tmp15_i2_1, ptr_arrayidx13_i_1, false, label_forbody_138); std::vector ptr_arrayidx17_i_1_indices; - ptr_arrayidx17_i_1_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arrayidx17_i_1_indices.push_back(const_int32_34); - ptr_arrayidx17_i_1_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx17_i_1 = new GetElementPtrInst(ptr_dests_121, ptr_arrayidx17_i_1_indices.begin(), ptr_arrayidx17_i_1_indices.end(), "arrayidx17.i.1", label_forbody_130); - ExtractElementInst* float_tmp19_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_35, "tmp19.i.1", label_forbody_130); - StoreInst* void_182 = new StoreInst(float_tmp19_i_1, ptr_arrayidx17_i_1, false, label_forbody_130); + ptr_arrayidx17_i_1_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx17_i_1_indices.push_back(const_int32_36); + ptr_arrayidx17_i_1_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx17_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx17_i_1_indices.begin(), ptr_arrayidx17_i_1_indices.end(), "arrayidx17.i.1", label_forbody_138); + ExtractElementInst* float_tmp19_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_37, "tmp19.i.1", label_forbody_138); + StoreInst* void_195 = new StoreInst(float_tmp19_i_1, ptr_arrayidx17_i_1, false, label_forbody_138); std::vector ptr_arrayidx21_i_1_indices; - ptr_arrayidx21_i_1_indices.push_back(int32_i_0_reg2mem_0_173); - ptr_arrayidx21_i_1_indices.push_back(const_int32_34); + ptr_arrayidx21_i_1_indices.push_back(int32_i_0_reg2mem_0_184); ptr_arrayidx21_i_1_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx21_i_1 = new GetElementPtrInst(ptr_dests_121, ptr_arrayidx21_i_1_indices.begin(), ptr_arrayidx21_i_1_indices.end(), "arrayidx21.i.1", label_forbody_130); - ExtractElementInst* float_tmp23_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_36, "tmp23.i.1", label_forbody_130); - StoreInst* void_183 = new StoreInst(float_tmp23_i_1, ptr_arrayidx21_i_1, false, label_forbody_130); - BinaryOperator* int32_indvar_next20 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_173, const_int32_34, "indvar.next20", label_forbody_130); - ICmpInst* int1_exitcond21 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next20, const_int32_37, "exitcond21", label_forbody_130); - new BranchInst(label_afterfor_131, label_forbody_130, int1_exitcond21, label_forbody_130); - - // Block afterfor (label_afterfor_131) - new ReturnInst(const_int32_38, label_afterfor_131); + ptr_arrayidx21_i_1_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx21_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx21_i_1_indices.begin(), ptr_arrayidx21_i_1_indices.end(), "arrayidx21.i.1", label_forbody_138); + ExtractElementInst* float_tmp23_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_38, "tmp23.i.1", label_forbody_138); + StoreInst* void_196 = new StoreInst(float_tmp23_i_1, ptr_arrayidx21_i_1, false, label_forbody_138); + BinaryOperator* int32_indvar_next20 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_184, const_int32_36, "indvar.next20", label_forbody_138); + ICmpInst* int1_exitcond21 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next20, const_int32_39, "exitcond21", label_forbody_138); + new BranchInst(label_afterfor_139, label_forbody_138, int1_exitcond21, label_forbody_138); + + // Block afterfor (label_afterfor_139) + std::vector ptr_tmp26_indices; + ptr_tmp26_indices.push_back(const_int32_34); + ptr_tmp26_indices.push_back(const_int32_39); + Instruction* ptr_tmp26 = new GetElementPtrInst(ptr_args_144, ptr_tmp26_indices.begin(), ptr_tmp26_indices.end(), "tmp26", label_afterfor_139); + LoadInst* int32_tmp27 = new LoadInst(ptr_tmp26, "tmp27", false, label_afterfor_139); + BinaryOperator* int32_neg = BinaryOperator::create(Instruction::Xor, int32_tmp27, const_int32_40, "neg", label_afterfor_139); + new ReturnInst(int32_neg, label_afterfor_139); // Block forbody6.i.1 (label_forbody6_i_1) - Argument* fwdref_186 = new Argument(IntegerType::get(32)); + Argument* fwdref_199 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0_i_1 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.1", label_forbody6_i_1); int32_j_0_reg2mem_0_i_1->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_1->addIncoming(const_int32_32, label_forbody6_i_127); - int32_j_0_reg2mem_0_i_1->addIncoming(fwdref_186, label_forbody6_i_1); + int32_j_0_reg2mem_0_i_1->addIncoming(const_int32_34, label_forbody6_i_135); + int32_j_0_reg2mem_0_i_1->addIncoming(fwdref_199, label_forbody6_i_1); - Argument* fwdref_187 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0_i_1 = new PHINode(VectorTy_13, "vec.0.reg2mem.0.i.1", label_forbody6_i_1); + Argument* fwdref_200 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i_1 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.1", label_forbody6_i_1); packed_vec_0_reg2mem_0_i_1->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_1->addIncoming(packed_tmp48_i_153, label_forbody6_i_127); - packed_vec_0_reg2mem_0_i_1->addIncoming(fwdref_187, label_forbody6_i_1); + packed_vec_0_reg2mem_0_i_1->addIncoming(packed_tmp48_i_162, label_forbody6_i_135); + packed_vec_0_reg2mem_0_i_1->addIncoming(fwdref_200, label_forbody6_i_1); std::vector ptr_arraydecay11_i_1_indices; - ptr_arraydecay11_i_1_indices.push_back(const_int32_34); + ptr_arraydecay11_i_1_indices.push_back(const_int32_36); ptr_arraydecay11_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - ptr_arraydecay11_i_1_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay11_i_1 = new GetElementPtrInst(ptr_ainputs_122, ptr_arraydecay11_i_1_indices.begin(), ptr_arraydecay11_i_1_indices.end(), "arraydecay11.i.1", label_forbody6_i_1); + ptr_arraydecay11_i_1_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay11_i_1 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_1_indices.begin(), ptr_arraydecay11_i_1_indices.end(), "arraydecay11.i.1", label_forbody6_i_1); LoadInst* float_tmp13_i_1 = new LoadInst(ptr_arraydecay11_i_1, "tmp13.i.1", false, label_forbody6_i_1); - InsertElementInst* packed_tmp15_i_1 = new InsertElementInst(packed_vec_0_reg2mem_0_i_1, float_tmp13_i_1, const_int32_32, "tmp15.i.1", label_forbody6_i_1); + InsertElementInst* packed_tmp15_i_1 = new InsertElementInst(packed_vec_0_reg2mem_0_i_1, float_tmp13_i_1, const_int32_34, "tmp15.i.1", label_forbody6_i_1); std::vector ptr_arrayidx23_i_1_indices; - ptr_arrayidx23_i_1_indices.push_back(const_int32_34); + ptr_arrayidx23_i_1_indices.push_back(const_int32_36); ptr_arrayidx23_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - ptr_arrayidx23_i_1_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx23_i_1 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx23_i_1_indices.begin(), ptr_arrayidx23_i_1_indices.end(), "arrayidx23.i.1", label_forbody6_i_1); + ptr_arrayidx23_i_1_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx23_i_1 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_1_indices.begin(), ptr_arrayidx23_i_1_indices.end(), "arrayidx23.i.1", label_forbody6_i_1); LoadInst* float_tmp24_i_1 = new LoadInst(ptr_arrayidx23_i_1, "tmp24.i.1", false, label_forbody6_i_1); - InsertElementInst* packed_tmp26_i_1 = new InsertElementInst(packed_tmp15_i_1, float_tmp24_i_1, const_int32_34, "tmp26.i.1", label_forbody6_i_1); + InsertElementInst* packed_tmp26_i_1 = new InsertElementInst(packed_tmp15_i_1, float_tmp24_i_1, const_int32_36, "tmp26.i.1", label_forbody6_i_1); std::vector ptr_arrayidx34_i_1_indices; - ptr_arrayidx34_i_1_indices.push_back(const_int32_34); + ptr_arrayidx34_i_1_indices.push_back(const_int32_36); ptr_arrayidx34_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - ptr_arrayidx34_i_1_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx34_i_1 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx34_i_1_indices.begin(), ptr_arrayidx34_i_1_indices.end(), "arrayidx34.i.1", label_forbody6_i_1); + ptr_arrayidx34_i_1_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx34_i_1 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_1_indices.begin(), ptr_arrayidx34_i_1_indices.end(), "arrayidx34.i.1", label_forbody6_i_1); LoadInst* float_tmp35_i_1 = new LoadInst(ptr_arrayidx34_i_1, "tmp35.i.1", false, label_forbody6_i_1); - InsertElementInst* packed_tmp37_i_1 = new InsertElementInst(packed_tmp26_i_1, float_tmp35_i_1, const_int32_35, "tmp37.i.1", label_forbody6_i_1); + InsertElementInst* packed_tmp37_i_1 = new InsertElementInst(packed_tmp26_i_1, float_tmp35_i_1, const_int32_37, "tmp37.i.1", label_forbody6_i_1); std::vector ptr_arrayidx45_i_1_indices; - ptr_arrayidx45_i_1_indices.push_back(const_int32_34); - ptr_arrayidx45_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); ptr_arrayidx45_i_1_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx45_i_1 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx45_i_1_indices.begin(), ptr_arrayidx45_i_1_indices.end(), "arrayidx45.i.1", label_forbody6_i_1); + ptr_arrayidx45_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); + ptr_arrayidx45_i_1_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx45_i_1 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_1_indices.begin(), ptr_arrayidx45_i_1_indices.end(), "arrayidx45.i.1", label_forbody6_i_1); LoadInst* float_tmp46_i_1 = new LoadInst(ptr_arrayidx45_i_1, "tmp46.i.1", false, label_forbody6_i_1); - InsertElementInst* packed_tmp48_i_1 = new InsertElementInst(packed_tmp37_i_1, float_tmp46_i_1, const_int32_36, "tmp48.i.1", label_forbody6_i_1); + InsertElementInst* packed_tmp48_i_1 = new InsertElementInst(packed_tmp37_i_1, float_tmp46_i_1, const_int32_38, "tmp48.i.1", label_forbody6_i_1); std::vector ptr_arrayidx54_i_1_indices; - ptr_arrayidx54_i_1_indices.push_back(const_int32_32); ptr_arrayidx54_i_1_indices.push_back(const_int32_34); + ptr_arrayidx54_i_1_indices.push_back(const_int32_36); ptr_arrayidx54_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - Instruction* ptr_arrayidx54_i_1 = new GetElementPtrInst(ptr_inputs_132, ptr_arrayidx54_i_1_indices.begin(), ptr_arrayidx54_i_1_indices.end(), "arrayidx54.i.1", label_forbody6_i_1); - StoreInst* void_188 = new StoreInst(packed_tmp48_i_1, ptr_arrayidx54_i_1, false, label_forbody6_i_1); - BinaryOperator* int32_inc_i_1 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_1, const_int32_34, "inc.i.1", label_forbody6_i_1); - ICmpInst* int1_cmp59_i_1 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_1, int32_num_inputs_123, "cmp59.i.1", label_forbody6_i_1); + Instruction* ptr_arrayidx54_i_1 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_1_indices.begin(), ptr_arrayidx54_i_1_indices.end(), "arrayidx54.i.1", label_forbody6_i_1); + StoreInst* void_201 = new StoreInst(packed_tmp48_i_1, ptr_arrayidx54_i_1, false, label_forbody6_i_1); + BinaryOperator* int32_inc_i_1 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_1, const_int32_36, "inc.i.1", label_forbody6_i_1); + ICmpInst* int1_cmp59_i_1 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_1, int32_num_inputs_131, "cmp59.i.1", label_forbody6_i_1); new BranchInst(label_forbody6_i_1, label_forbody6_i_2, int1_cmp59_i_1, label_forbody6_i_1); // Block forbody6.i.2 (label_forbody6_i_2) - Argument* fwdref_190 = new Argument(IntegerType::get(32)); + Argument* fwdref_203 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0_i_2 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.2", label_forbody6_i_2); int32_j_0_reg2mem_0_i_2->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_2->addIncoming(const_int32_32, label_forbody6_i_1); - int32_j_0_reg2mem_0_i_2->addIncoming(fwdref_190, label_forbody6_i_2); + int32_j_0_reg2mem_0_i_2->addIncoming(const_int32_34, label_forbody6_i_1); + int32_j_0_reg2mem_0_i_2->addIncoming(fwdref_203, label_forbody6_i_2); - Argument* fwdref_191 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0_i_2 = new PHINode(VectorTy_13, "vec.0.reg2mem.0.i.2", label_forbody6_i_2); + Argument* fwdref_204 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i_2 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.2", label_forbody6_i_2); packed_vec_0_reg2mem_0_i_2->reserveOperandSpace(2); packed_vec_0_reg2mem_0_i_2->addIncoming(packed_tmp48_i_1, label_forbody6_i_1); - packed_vec_0_reg2mem_0_i_2->addIncoming(fwdref_191, label_forbody6_i_2); + packed_vec_0_reg2mem_0_i_2->addIncoming(fwdref_204, label_forbody6_i_2); std::vector ptr_arraydecay11_i_2_indices; - ptr_arraydecay11_i_2_indices.push_back(const_int32_35); + ptr_arraydecay11_i_2_indices.push_back(const_int32_37); ptr_arraydecay11_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - ptr_arraydecay11_i_2_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay11_i_2 = new GetElementPtrInst(ptr_ainputs_122, ptr_arraydecay11_i_2_indices.begin(), ptr_arraydecay11_i_2_indices.end(), "arraydecay11.i.2", label_forbody6_i_2); + ptr_arraydecay11_i_2_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay11_i_2 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_2_indices.begin(), ptr_arraydecay11_i_2_indices.end(), "arraydecay11.i.2", label_forbody6_i_2); LoadInst* float_tmp13_i_2 = new LoadInst(ptr_arraydecay11_i_2, "tmp13.i.2", false, label_forbody6_i_2); - InsertElementInst* packed_tmp15_i_2 = new InsertElementInst(packed_vec_0_reg2mem_0_i_2, float_tmp13_i_2, const_int32_32, "tmp15.i.2", label_forbody6_i_2); + InsertElementInst* packed_tmp15_i_2 = new InsertElementInst(packed_vec_0_reg2mem_0_i_2, float_tmp13_i_2, const_int32_34, "tmp15.i.2", label_forbody6_i_2); std::vector ptr_arrayidx23_i_2_indices; - ptr_arrayidx23_i_2_indices.push_back(const_int32_35); + ptr_arrayidx23_i_2_indices.push_back(const_int32_37); ptr_arrayidx23_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - ptr_arrayidx23_i_2_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx23_i_2 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx23_i_2_indices.begin(), ptr_arrayidx23_i_2_indices.end(), "arrayidx23.i.2", label_forbody6_i_2); + ptr_arrayidx23_i_2_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx23_i_2 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_2_indices.begin(), ptr_arrayidx23_i_2_indices.end(), "arrayidx23.i.2", label_forbody6_i_2); LoadInst* float_tmp24_i_2 = new LoadInst(ptr_arrayidx23_i_2, "tmp24.i.2", false, label_forbody6_i_2); - InsertElementInst* packed_tmp26_i_2 = new InsertElementInst(packed_tmp15_i_2, float_tmp24_i_2, const_int32_34, "tmp26.i.2", label_forbody6_i_2); + InsertElementInst* packed_tmp26_i_2 = new InsertElementInst(packed_tmp15_i_2, float_tmp24_i_2, const_int32_36, "tmp26.i.2", label_forbody6_i_2); std::vector ptr_arrayidx34_i_2_indices; - ptr_arrayidx34_i_2_indices.push_back(const_int32_35); + ptr_arrayidx34_i_2_indices.push_back(const_int32_37); ptr_arrayidx34_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - ptr_arrayidx34_i_2_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx34_i_2 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx34_i_2_indices.begin(), ptr_arrayidx34_i_2_indices.end(), "arrayidx34.i.2", label_forbody6_i_2); + ptr_arrayidx34_i_2_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx34_i_2 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_2_indices.begin(), ptr_arrayidx34_i_2_indices.end(), "arrayidx34.i.2", label_forbody6_i_2); LoadInst* float_tmp35_i_2 = new LoadInst(ptr_arrayidx34_i_2, "tmp35.i.2", false, label_forbody6_i_2); - InsertElementInst* packed_tmp37_i_2 = new InsertElementInst(packed_tmp26_i_2, float_tmp35_i_2, const_int32_35, "tmp37.i.2", label_forbody6_i_2); + InsertElementInst* packed_tmp37_i_2 = new InsertElementInst(packed_tmp26_i_2, float_tmp35_i_2, const_int32_37, "tmp37.i.2", label_forbody6_i_2); std::vector ptr_arrayidx45_i_2_indices; - ptr_arrayidx45_i_2_indices.push_back(const_int32_35); + ptr_arrayidx45_i_2_indices.push_back(const_int32_37); ptr_arrayidx45_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - ptr_arrayidx45_i_2_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx45_i_2 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx45_i_2_indices.begin(), ptr_arrayidx45_i_2_indices.end(), "arrayidx45.i.2", label_forbody6_i_2); + ptr_arrayidx45_i_2_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx45_i_2 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_2_indices.begin(), ptr_arrayidx45_i_2_indices.end(), "arrayidx45.i.2", label_forbody6_i_2); LoadInst* float_tmp46_i_2 = new LoadInst(ptr_arrayidx45_i_2, "tmp46.i.2", false, label_forbody6_i_2); - InsertElementInst* packed_tmp48_i_2 = new InsertElementInst(packed_tmp37_i_2, float_tmp46_i_2, const_int32_36, "tmp48.i.2", label_forbody6_i_2); + InsertElementInst* packed_tmp48_i_2 = new InsertElementInst(packed_tmp37_i_2, float_tmp46_i_2, const_int32_38, "tmp48.i.2", label_forbody6_i_2); std::vector ptr_arrayidx54_i_2_indices; - ptr_arrayidx54_i_2_indices.push_back(const_int32_32); - ptr_arrayidx54_i_2_indices.push_back(const_int32_35); + ptr_arrayidx54_i_2_indices.push_back(const_int32_34); + ptr_arrayidx54_i_2_indices.push_back(const_int32_37); ptr_arrayidx54_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - Instruction* ptr_arrayidx54_i_2 = new GetElementPtrInst(ptr_inputs_132, ptr_arrayidx54_i_2_indices.begin(), ptr_arrayidx54_i_2_indices.end(), "arrayidx54.i.2", label_forbody6_i_2); - StoreInst* void_192 = new StoreInst(packed_tmp48_i_2, ptr_arrayidx54_i_2, false, label_forbody6_i_2); - BinaryOperator* int32_inc_i_2 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_2, const_int32_34, "inc.i.2", label_forbody6_i_2); - ICmpInst* int1_cmp59_i_2 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_2, int32_num_inputs_123, "cmp59.i.2", label_forbody6_i_2); + Instruction* ptr_arrayidx54_i_2 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_2_indices.begin(), ptr_arrayidx54_i_2_indices.end(), "arrayidx54.i.2", label_forbody6_i_2); + StoreInst* void_205 = new StoreInst(packed_tmp48_i_2, ptr_arrayidx54_i_2, false, label_forbody6_i_2); + BinaryOperator* int32_inc_i_2 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_2, const_int32_36, "inc.i.2", label_forbody6_i_2); + ICmpInst* int1_cmp59_i_2 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_2, int32_num_inputs_131, "cmp59.i.2", label_forbody6_i_2); new BranchInst(label_forbody6_i_2, label_forbody6_i_3, int1_cmp59_i_2, label_forbody6_i_2); // Block forbody6.i.3 (label_forbody6_i_3) - Argument* fwdref_194 = new Argument(IntegerType::get(32)); + Argument* fwdref_207 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0_i_3 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.3", label_forbody6_i_3); int32_j_0_reg2mem_0_i_3->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_3->addIncoming(const_int32_32, label_forbody6_i_2); - int32_j_0_reg2mem_0_i_3->addIncoming(fwdref_194, label_forbody6_i_3); + int32_j_0_reg2mem_0_i_3->addIncoming(const_int32_34, label_forbody6_i_2); + int32_j_0_reg2mem_0_i_3->addIncoming(fwdref_207, label_forbody6_i_3); - Argument* fwdref_195 = new Argument(VectorTy_13); - PHINode* packed_vec_0_reg2mem_0_i_3 = new PHINode(VectorTy_13, "vec.0.reg2mem.0.i.3", label_forbody6_i_3); + Argument* fwdref_208 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i_3 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.3", label_forbody6_i_3); packed_vec_0_reg2mem_0_i_3->reserveOperandSpace(2); packed_vec_0_reg2mem_0_i_3->addIncoming(packed_tmp48_i_2, label_forbody6_i_2); - packed_vec_0_reg2mem_0_i_3->addIncoming(fwdref_195, label_forbody6_i_3); + packed_vec_0_reg2mem_0_i_3->addIncoming(fwdref_208, label_forbody6_i_3); std::vector ptr_arraydecay11_i_3_indices; - ptr_arraydecay11_i_3_indices.push_back(const_int32_36); + ptr_arraydecay11_i_3_indices.push_back(const_int32_38); ptr_arraydecay11_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - ptr_arraydecay11_i_3_indices.push_back(const_int32_32); - Instruction* ptr_arraydecay11_i_3 = new GetElementPtrInst(ptr_ainputs_122, ptr_arraydecay11_i_3_indices.begin(), ptr_arraydecay11_i_3_indices.end(), "arraydecay11.i.3", label_forbody6_i_3); + ptr_arraydecay11_i_3_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay11_i_3 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_3_indices.begin(), ptr_arraydecay11_i_3_indices.end(), "arraydecay11.i.3", label_forbody6_i_3); LoadInst* float_tmp13_i_3 = new LoadInst(ptr_arraydecay11_i_3, "tmp13.i.3", false, label_forbody6_i_3); - InsertElementInst* packed_tmp15_i_3 = new InsertElementInst(packed_vec_0_reg2mem_0_i_3, float_tmp13_i_3, const_int32_32, "tmp15.i.3", label_forbody6_i_3); + InsertElementInst* packed_tmp15_i_3 = new InsertElementInst(packed_vec_0_reg2mem_0_i_3, float_tmp13_i_3, const_int32_34, "tmp15.i.3", label_forbody6_i_3); std::vector ptr_arrayidx23_i_3_indices; - ptr_arrayidx23_i_3_indices.push_back(const_int32_36); + ptr_arrayidx23_i_3_indices.push_back(const_int32_38); ptr_arrayidx23_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - ptr_arrayidx23_i_3_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx23_i_3 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx23_i_3_indices.begin(), ptr_arrayidx23_i_3_indices.end(), "arrayidx23.i.3", label_forbody6_i_3); + ptr_arrayidx23_i_3_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx23_i_3 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_3_indices.begin(), ptr_arrayidx23_i_3_indices.end(), "arrayidx23.i.3", label_forbody6_i_3); LoadInst* float_tmp24_i_3 = new LoadInst(ptr_arrayidx23_i_3, "tmp24.i.3", false, label_forbody6_i_3); - InsertElementInst* packed_tmp26_i_3 = new InsertElementInst(packed_tmp15_i_3, float_tmp24_i_3, const_int32_34, "tmp26.i.3", label_forbody6_i_3); + InsertElementInst* packed_tmp26_i_3 = new InsertElementInst(packed_tmp15_i_3, float_tmp24_i_3, const_int32_36, "tmp26.i.3", label_forbody6_i_3); std::vector ptr_arrayidx34_i_3_indices; - ptr_arrayidx34_i_3_indices.push_back(const_int32_36); + ptr_arrayidx34_i_3_indices.push_back(const_int32_38); ptr_arrayidx34_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - ptr_arrayidx34_i_3_indices.push_back(const_int32_35); - Instruction* ptr_arrayidx34_i_3 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx34_i_3_indices.begin(), ptr_arrayidx34_i_3_indices.end(), "arrayidx34.i.3", label_forbody6_i_3); + ptr_arrayidx34_i_3_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx34_i_3 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_3_indices.begin(), ptr_arrayidx34_i_3_indices.end(), "arrayidx34.i.3", label_forbody6_i_3); LoadInst* float_tmp35_i_3 = new LoadInst(ptr_arrayidx34_i_3, "tmp35.i.3", false, label_forbody6_i_3); - InsertElementInst* packed_tmp37_i_3 = new InsertElementInst(packed_tmp26_i_3, float_tmp35_i_3, const_int32_35, "tmp37.i.3", label_forbody6_i_3); + InsertElementInst* packed_tmp37_i_3 = new InsertElementInst(packed_tmp26_i_3, float_tmp35_i_3, const_int32_37, "tmp37.i.3", label_forbody6_i_3); std::vector ptr_arrayidx45_i_3_indices; - ptr_arrayidx45_i_3_indices.push_back(const_int32_36); + ptr_arrayidx45_i_3_indices.push_back(const_int32_38); ptr_arrayidx45_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - ptr_arrayidx45_i_3_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx45_i_3 = new GetElementPtrInst(ptr_ainputs_122, ptr_arrayidx45_i_3_indices.begin(), ptr_arrayidx45_i_3_indices.end(), "arrayidx45.i.3", label_forbody6_i_3); + ptr_arrayidx45_i_3_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx45_i_3 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_3_indices.begin(), ptr_arrayidx45_i_3_indices.end(), "arrayidx45.i.3", label_forbody6_i_3); LoadInst* float_tmp46_i_3 = new LoadInst(ptr_arrayidx45_i_3, "tmp46.i.3", false, label_forbody6_i_3); - InsertElementInst* packed_tmp48_i_3 = new InsertElementInst(packed_tmp37_i_3, float_tmp46_i_3, const_int32_36, "tmp48.i.3", label_forbody6_i_3); + InsertElementInst* packed_tmp48_i_3 = new InsertElementInst(packed_tmp37_i_3, float_tmp46_i_3, const_int32_38, "tmp48.i.3", label_forbody6_i_3); std::vector ptr_arrayidx54_i_3_indices; - ptr_arrayidx54_i_3_indices.push_back(const_int32_32); - ptr_arrayidx54_i_3_indices.push_back(const_int32_36); + ptr_arrayidx54_i_3_indices.push_back(const_int32_34); + ptr_arrayidx54_i_3_indices.push_back(const_int32_38); ptr_arrayidx54_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - Instruction* ptr_arrayidx54_i_3 = new GetElementPtrInst(ptr_inputs_132, ptr_arrayidx54_i_3_indices.begin(), ptr_arrayidx54_i_3_indices.end(), "arrayidx54.i.3", label_forbody6_i_3); - StoreInst* void_196 = new StoreInst(packed_tmp48_i_3, ptr_arrayidx54_i_3, false, label_forbody6_i_3); - BinaryOperator* int32_inc_i_3 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_3, const_int32_34, "inc.i.3", label_forbody6_i_3); - ICmpInst* int1_cmp59_i_3 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_3, int32_num_inputs_123, "cmp59.i.3", label_forbody6_i_3); - new BranchInst(label_forbody6_i_3, label_from_array_exit_128, int1_cmp59_i_3, label_forbody6_i_3); + Instruction* ptr_arrayidx54_i_3 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_3_indices.begin(), ptr_arrayidx54_i_3_indices.end(), "arrayidx54.i.3", label_forbody6_i_3); + StoreInst* void_209 = new StoreInst(packed_tmp48_i_3, ptr_arrayidx54_i_3, false, label_forbody6_i_3); + BinaryOperator* int32_inc_i_3 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_3, const_int32_36, "inc.i.3", label_forbody6_i_3); + ICmpInst* int1_cmp59_i_3 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_3, int32_num_inputs_131, "cmp59.i.3", label_forbody6_i_3); + new BranchInst(label_forbody6_i_3, label_from_array_exit_136, int1_cmp59_i_3, label_forbody6_i_3); // Resolve Forward References - fwdref_195->replaceAllUsesWith(packed_tmp48_i_3); delete fwdref_195; - fwdref_194->replaceAllUsesWith(int32_inc_i_3); delete fwdref_194; - fwdref_141->replaceAllUsesWith(packed_tmp48_i_153); delete fwdref_141; - fwdref_139->replaceAllUsesWith(int32_inc_i_156); delete fwdref_139; - fwdref_162->replaceAllUsesWith(packed_tmp31_i_169); delete fwdref_162; - fwdref_161->replaceAllUsesWith(int32_indvar_next22); delete fwdref_161; - fwdref_174->replaceAllUsesWith(int32_indvar_next20); delete fwdref_174; - fwdref_187->replaceAllUsesWith(packed_tmp48_i_1); delete fwdref_187; - fwdref_186->replaceAllUsesWith(int32_inc_i_1); delete fwdref_186; - fwdref_191->replaceAllUsesWith(packed_tmp48_i_2); delete fwdref_191; - fwdref_190->replaceAllUsesWith(int32_inc_i_2); delete fwdref_190; + fwdref_208->replaceAllUsesWith(packed_tmp48_i_3); delete fwdref_208; + fwdref_207->replaceAllUsesWith(int32_inc_i_3); delete fwdref_207; + fwdref_150->replaceAllUsesWith(packed_tmp48_i_162); delete fwdref_150; + fwdref_148->replaceAllUsesWith(int32_inc_i_165); delete fwdref_148; + fwdref_171->replaceAllUsesWith(packed_tmp31_i_178); delete fwdref_171; + fwdref_170->replaceAllUsesWith(int32_indvar_next22); delete fwdref_170; + fwdref_185->replaceAllUsesWith(int32_indvar_next20); delete fwdref_185; + fwdref_200->replaceAllUsesWith(packed_tmp48_i_1); delete fwdref_200; + fwdref_199->replaceAllUsesWith(int32_inc_i_1); delete fwdref_199; + fwdref_204->replaceAllUsesWith(packed_tmp48_i_2); delete fwdref_204; + fwdref_203->replaceAllUsesWith(int32_inc_i_2); delete fwdref_203; } diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c index cbe4965ef6..6bdb311c2b 100644 --- a/src/mesa/pipe/llvm/llvm_entry.c +++ b/src/mesa/pipe/llvm/llvm_entry.c @@ -1,4 +1,4 @@ -/* clang --emit-llvm llvm_builtins.c |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -funcname=createBaseShader */ +/* clang --emit-llvm llvm_entry.c |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -funcname=createBaseShader */ /************************************************************************** * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. @@ -164,8 +164,17 @@ void to_array(float (*dests)[4], float4 *in, int num_attribs) } } -extern void execute_shader(float4 dests[16], float4 inputs[16], - float4 consts[32], float4 temps[128]); + +struct ShaderInput +{ + float4 *dests; + float4 *inputs; + float4 *temps; + float4 *consts; + int kilmask; +}; + +extern void execute_shader(struct ShaderInput *input); void run_vertex_shader(float (*ainputs)[16][4], float (*dests)[16][4], @@ -180,15 +189,18 @@ void run_vertex_shader(float (*ainputs)[16][4], float4 results[16*32*4][16]; float4 temps[128];//MAX_PROGRAM_TEMPS + struct ShaderInput args; /*printf("XXX LLVM run_vertex_shader vertices = %d, inputs = %d, attribs = %d, consts = %d\n", num_vertices, num_inputs, num_attribs, num_consts);*/ from_array(inputs, ainputs, num_vertices, num_inputs); from_consts(consts, aconsts, num_consts); + args.consts = consts; + args.temps = temps; for (int i = 0; i < num_vertices; ++i) { - float4 *in = inputs[i]; - float4 *res = results[i]; - execute_shader(res, in, consts, temps); - to_array(dests[i], res, num_attribs); + args.dests = results[i]; + args.inputs = inputs[i]; + execute_shader(&args); + to_array(dests[i], args.dests, num_attribs); } } @@ -213,6 +225,7 @@ struct tgsi_sampler struct softpipe_tile_cache *cache; }; + int run_fragment_shader(float x, float y, float (*dests)[16][4], float (*ainputs)[16][4], @@ -225,17 +238,19 @@ int run_fragment_shader(float x, float y, float4 consts[32]; float4 results[4][16]; float4 temps[128];//MAX_PROGRAM_TEMPS - int kilmask = 0; + struct ShaderInput args; from_array(inputs, ainputs, 4, num_inputs); from_consts(consts, aconsts, num_consts); + args.consts = consts; + args.temps = temps; //printf("AAAAAAAAAAAAAAAAAAAAAAA FRAGMENT SHADER %f %f\n", x, y); for (int i = 0; i < 4; ++i) { - float4 *in = inputs[i]; - float4 *res = results[i]; - execute_shader(res, in, consts, temps); - to_array(dests[i], res, 2); + args.inputs = inputs[i]; + args.dests = results[i]; + execute_shader(&args); + to_array(dests[i], args.dests, 2); } - return ~kilmask; + return ~args.kilmask; } diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/mesa/pipe/llvm/storage.cpp index 1715bd4de4..71045fa37f 100644 --- a/src/mesa/pipe/llvm/storage.cpp +++ b/src/mesa/pipe/llvm/storage.cpp @@ -46,12 +46,10 @@ using namespace llvm; -Storage::Storage(llvm::BasicBlock *block, llvm::Value *out, - llvm::Value *in, llvm::Value *consts, llvm::Value *temps) - : m_block(block), m_OUT(out), - m_IN(in), m_CONST(consts), m_TEMPS(temps), +Storage::Storage(llvm::BasicBlock *block, llvm::Value *input) + : m_block(block), + m_INPUT(input), m_addrs(32), - m_dstCache(32), m_idx(0) { m_floatVecType = VectorType::get(Type::FloatTy, 4); @@ -112,26 +110,8 @@ llvm::ConstantInt *Storage::constantInt(int idx) llvm::Value *Storage::inputElement(int idx, llvm::Value *indIdx) { - GetElementPtrInst *getElem = 0; - - if (indIdx) { - getElem = new GetElementPtrInst(m_IN, - BinaryOperator::create(Instruction::Add, - indIdx, - constantInt(idx), - name("add"), - m_block), - name("input_ptr"), - m_block); - } else { - getElem = new GetElementPtrInst(m_IN, - constantInt(idx), - name("input_ptr"), - m_block); - } - - LoadInst *load = new LoadInst(getElem, name("input"), - false, m_block); + Value *val = element(InputsArg, idx, indIdx); + LoadInst *load = new LoadInst(val, name("input"), false, m_block); load->setAlignment(8); return load; @@ -141,24 +121,8 @@ llvm::Value *Storage::constElement(int idx, llvm::Value *indIdx) { m_numConsts = ((idx + 1) > m_numConsts) ? (idx + 1) : m_numConsts; - GetElementPtrInst *getElem = 0; - - if (indIdx) - getElem = new GetElementPtrInst(m_CONST, - BinaryOperator::create(Instruction::Add, - indIdx, - constantInt(idx), - name("add"), - m_block), - name("const_ptr"), - m_block); - else - getElem = new GetElementPtrInst(m_CONST, - constantInt(idx), - name("const_ptr"), - m_block); - LoadInst *load = new LoadInst(getElem, name("const"), - false, m_block); + Value *elem = element(ConstsArg, idx, indIdx); + LoadInst *load = new LoadInst(elem, name("const"), false, m_block); load->setAlignment(8); return load; } @@ -175,26 +139,9 @@ llvm::Value *Storage::shuffleVector(llvm::Value *vec, int shuffle) llvm::Value *Storage::tempElement(int idx, llvm::Value *indIdx) { - GetElementPtrInst *getElem = 0; + Value *elem = element(TempsArg, idx, indIdx); - if (indIdx) { - getElem = new GetElementPtrInst(m_TEMPS, - BinaryOperator::create(Instruction::Add, - indIdx, - constantInt(idx), - name("add"), - m_block), - name("temp_ptr"), - m_block); - } else { - getElem = new GetElementPtrInst(m_TEMPS, - constantInt(idx), - name("temp_ptr"), - m_block); - } - - LoadInst *load = new LoadInst(getElem, name("temp"), - false, m_block); + LoadInst *load = new LoadInst(elem, name("temp"), false, m_block); load->setAlignment(8); return load; @@ -208,11 +155,8 @@ void Storage::setTempElement(int idx, llvm::Value *val, int mask) templ = tempElement(idx); val = maskWrite(val, mask, templ); } - GetElementPtrInst *getElem = new GetElementPtrInst(m_TEMPS, - constantInt(idx), - name("temp_ptr"), - m_block); - StoreInst *st = new StoreInst(val, getElem, false, m_block); + Value *elem = element(TempsArg, idx); + StoreInst *st = new StoreInst(val, elem, false, m_block); st->setAlignment(8); m_tempWriteMap[idx] = true; } @@ -226,11 +170,8 @@ void Storage::setOutputElement(int dstIdx, llvm::Value *val, int mask) val = maskWrite(val, mask, templ); } - GetElementPtrInst *getElem = new GetElementPtrInst(m_OUT, - constantInt(dstIdx), - name("out_ptr"), - m_block); - StoreInst *st = new StoreInst(val, getElem, false, m_block); + Value *elem = element(DestsArg, dstIdx); + StoreInst *st = new StoreInst(val, elem, false, m_block); st->setAlignment(8); m_destWriteMap[dstIdx] = true; } @@ -310,26 +251,8 @@ void Storage::setCurrentBlock(llvm::BasicBlock *block) llvm::Value * Storage::outputElement(int idx, llvm::Value *indIdx) { - GetElementPtrInst *getElem = 0; - - if (indIdx) { - getElem = new GetElementPtrInst(m_OUT, - BinaryOperator::create(Instruction::Add, - indIdx, - constantInt(idx), - name("add"), - m_block), - name("output_ptr"), - m_block); - } else { - getElem = new GetElementPtrInst(m_OUT, - constantInt(idx), - name("output_ptr"), - m_block); - } - - LoadInst *load = new LoadInst(getElem, name("output"), - false, m_block); + Value *elem = element(DestsArg, idx, indIdx); + LoadInst *load = new LoadInst(elem, name("output"), false, m_block); load->setAlignment(8); return load; @@ -337,47 +260,19 @@ llvm::Value * Storage::outputElement(int idx, llvm::Value *indIdx) llvm::Value * Storage::inputPtr() const { - return m_IN; -} - -llvm::Value * Storage::outputPtr() const -{ - return m_OUT; -} - -llvm::Value * Storage::constPtr() const -{ - return m_CONST; + return m_INPUT; } -llvm::Value * Storage::tempPtr() const +void Storage::pushArguments(llvm::Value *input) { - return m_TEMPS; -} + m_argStack.push(m_INPUT); -void Storage::pushArguments(llvm::Value *out, llvm::Value *in, - llvm::Value *constPtr, llvm::Value *temp) -{ - Args arg; - arg.out = m_OUT; - arg.in = m_IN; - arg.cst = m_CONST; - arg.temp = m_TEMPS; - m_argStack.push(arg); - - m_OUT = out; - m_IN = in; - m_CONST = constPtr; - m_TEMPS = temp; + m_INPUT = input; } void Storage::popArguments() { - Args arg = m_argStack.top(); - m_OUT = arg.out; - m_IN = arg.in; - m_CONST = arg.cst; - m_TEMPS = arg.temp; + m_INPUT = m_argStack.top(); m_argStack.pop(); } @@ -405,4 +300,49 @@ void Storage::addImmediate(float *val) m_immediates.push_back(ConstantVector::get(m_floatVecType, vec)); } + +llvm::Value * Storage::elemPtr(Args arg) +{ + std::vector indices; + indices.push_back(constantInt(0)); + indices.push_back(constantInt(static_cast(arg))); + GetElementPtrInst *getElem = new GetElementPtrInst(m_INPUT, + indices.begin(), + indices.end(), + name("input_ptr"), + m_block); + return new LoadInst(getElem, name("input_field"), false, m_block); +} + +llvm::Value * Storage::elemIdx(llvm::Value *ptr, int idx, + llvm::Value *indIdx ) +{ + GetElementPtrInst *getElem = 0; + + if (indIdx) { + getElem = new GetElementPtrInst(ptr, + BinaryOperator::create(Instruction::Add, + indIdx, + constantInt(idx), + name("add"), + m_block), + name("field"), + m_block); + } else { + getElem = new GetElementPtrInst(ptr, + constantInt(idx), + name("field"), + m_block); + } + return getElem; +} + +llvm::Value * Storage::element(Args arg, int idx, llvm::Value *indIdx ) +{ + Value *val = elemPtr(arg); + return elemIdx(val, idx, indIdx); +} + #endif //MESA_LLVM + + diff --git a/src/mesa/pipe/llvm/storage.h b/src/mesa/pipe/llvm/storage.h index aa02f02f85..7f1a8bf103 100644 --- a/src/mesa/pipe/llvm/storage.h +++ b/src/mesa/pipe/llvm/storage.h @@ -51,13 +51,9 @@ class Storage { public: Storage(llvm::BasicBlock *block, - llvm::Value *out, - llvm::Value *in, llvm::Value *consts, llvm::Value *temps); + llvm::Value *input); llvm::Value *inputPtr() const; - llvm::Value *outputPtr() const; - llvm::Value *constPtr() const; - llvm::Value *tempPtr() const; void setCurrentBlock(llvm::BasicBlock *block); @@ -81,8 +77,7 @@ public: int numConsts() const; - void pushArguments(llvm::Value *out, llvm::Value *in, - llvm::Value *constPtr, llvm::Value *temp); + void pushArguments(llvm::Value *input); void popArguments(); void pushTemps(); void popTemps(); @@ -93,17 +88,25 @@ private: llvm::Value *maskWrite(llvm::Value *src, int mask, llvm::Value *templ); const char *name(const char *prefix); + enum Args { + DestsArg = 0, + InputsArg = 1, + TempsArg = 2, + ConstsArg = 3, + KilArg = 4 + }; + llvm::Value *elemPtr(Args arg); + llvm::Value *elemIdx(llvm::Value *ptr, int idx, + llvm::Value *indIdx = 0); + llvm::Value *element(Args arg, int idx, llvm::Value *indIdx = 0); + private: llvm::BasicBlock *m_block; - llvm::Value *m_OUT; - llvm::Value *m_IN; - llvm::Value *m_CONST; - llvm::Value *m_TEMPS; + llvm::Value *m_INPUT; std::map m_constInts; std::map m_intVecs; std::vector m_addrs; - std::vector m_dstCache; std::vector m_immediates; llvm::VectorType *m_floatVecType; @@ -121,13 +124,7 @@ private: llvm::Value *m_undefIntVec; llvm::Value *m_extSwizzleVec; - struct Args { - llvm::Value *out; - llvm::Value *in; - llvm::Value *cst; - llvm::Value *temp; - }; - std::stack m_argStack; + std::stack m_argStack; std::stack > m_tempStack; }; -- cgit v1.2.3 From 1f30efb7365075de0ae119a40ab70a16bc547670 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 6 Nov 2007 06:06:04 -0500 Subject: Implement kilp and make it work --- src/mesa/pipe/llvm/gallivm.cpp | 14 +- src/mesa/pipe/llvm/gallivm_builtins.cpp | 361 +++++++++++++++++------------- src/mesa/pipe/llvm/instructions.cpp | 10 + src/mesa/pipe/llvm/instructions.h | 1 + src/mesa/pipe/llvm/llvm_base_shader.cpp | 376 ++++++++++++++++---------------- src/mesa/pipe/llvm/llvm_builtins.c | 9 +- src/mesa/pipe/llvm/llvm_entry.c | 6 + src/mesa/pipe/llvm/storage.cpp | 14 ++ src/mesa/pipe/llvm/storage.h | 2 + src/mesa/pipe/softpipe/sp_quad_fs.c | 2 +- 10 files changed, 451 insertions(+), 344 deletions(-) (limited to 'src/mesa/pipe/llvm/llvm_base_shader.cpp') diff --git a/src/mesa/pipe/llvm/gallivm.cpp b/src/mesa/pipe/llvm/gallivm.cpp index 65c95074fd..a1101a7ba8 100644 --- a/src/mesa/pipe/llvm/gallivm.cpp +++ b/src/mesa/pipe/llvm/gallivm.cpp @@ -432,7 +432,11 @@ translate_instruction(llvm::Module *module, break; case TGSI_OPCODE_DDY: break; - case TGSI_OPCODE_KILP: + case TGSI_OPCODE_KILP: { + out = instr->kilp(inputs[0]); + storage->setKilElement(out); + return; + } break; case TGSI_OPCODE_PK2H: break; @@ -929,11 +933,9 @@ int gallivm_fragment_shader_exec(struct gallivm_prog *prog, fragment_shader_runner runner = reinterpret_cast(prog->function); assert(runner); - runner(fx, fy, dests, inputs, prog->num_interp, - consts, prog->num_consts, - samplers); - - return 0; + return runner(fx, fy, dests, inputs, prog->num_interp, + consts, prog->num_consts, + samplers); } void gallivm_prog_dump(struct gallivm_prog *prog, const char *file_prefix) diff --git a/src/mesa/pipe/llvm/gallivm_builtins.cpp b/src/mesa/pipe/llvm/gallivm_builtins.cpp index da1e6ae1de..48693ca2ed 100644 --- a/src/mesa/pipe/llvm/gallivm_builtins.cpp +++ b/src/mesa/pipe/llvm/gallivm_builtins.cpp @@ -69,6 +69,15 @@ FunctionType* FuncTy_12 = FunctionType::get( PointerType* PointerTy_11 = PointerType::get(FuncTy_12); +std::vectorFuncTy_13_args; +FuncTy_13_args.push_back(VectorTy_4); +ParamAttrsList *FuncTy_13_PAL = 0; +FunctionType* FuncTy_13 = FunctionType::get( + /*Result=*/IntegerType::get(32), + /*Params=*/FuncTy_13_args, + /*isVarArg=*/false, + /*ParamAttrs=*/FuncTy_13_PAL); + // Function Declarations @@ -132,6 +141,12 @@ Function* func_vsin = new Function( /*Name=*/"vsin", mod); func_vsin->setCallingConv(CallingConv::C); +Function* func_kilp = new Function( + /*Type=*/FuncTy_13, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"kilp", mod); +func_kilp->setCallingConv(CallingConv::C); + // Global Variable Declarations @@ -152,64 +167,64 @@ GlobalVariable* gvar_array__str1 = new GlobalVariable( mod); // Constant Definitions -Constant* const_array_13 = ConstantArray::get("VEC IN is %f %f %f %f\x0A", true); -Constant* const_array_14 = ConstantArray::get("VEC OUT is %f %f %f %f\x0A", true); -ConstantFP* const_float_15 = ConstantFP::get(Type::FloatTy, APFloat(-1.280000e+02f)); -ConstantFP* const_float_16 = ConstantFP::get(Type::FloatTy, APFloat(1.280000e+02f)); -Constant* const_float_17 = Constant::getNullValue(Type::FloatTy); -Constant* const_int32_18 = Constant::getNullValue(IntegerType::get(32)); -std::vector const_packed_19_elems; -ConstantFP* const_float_20 = ConstantFP::get(Type::FloatTy, APFloat(1.000000e+00f)); -const_packed_19_elems.push_back(const_float_20); -UndefValue* const_float_21 = UndefValue::get(Type::FloatTy); -const_packed_19_elems.push_back(const_float_21); -const_packed_19_elems.push_back(const_float_21); -const_packed_19_elems.push_back(const_float_20); -Constant* const_packed_19 = ConstantVector::get(VectorTy_4, const_packed_19_elems); -ConstantInt* const_int32_22 = ConstantInt::get(APInt(32, "1", 10)); -ConstantInt* const_int32_23 = ConstantInt::get(APInt(32, "3", 10)); -ConstantInt* const_int32_24 = ConstantInt::get(APInt(32, "2", 10)); -std::vector const_packed_25_elems; -const_packed_25_elems.push_back(const_float_20); -const_packed_25_elems.push_back(const_float_17); -const_packed_25_elems.push_back(const_float_17); -const_packed_25_elems.push_back(const_float_20); -Constant* const_packed_25 = ConstantVector::get(VectorTy_4, const_packed_25_elems); -Constant* const_double_26 = Constant::getNullValue(Type::DoubleTy); -std::vector const_packed_27_elems; -const_packed_27_elems.push_back(const_int32_18); -ConstantInt* const_int32_28 = ConstantInt::get(APInt(32, "5", 10)); -const_packed_27_elems.push_back(const_int32_28); -const_packed_27_elems.push_back(const_int32_24); -const_packed_27_elems.push_back(const_int32_23); -Constant* const_packed_27 = ConstantVector::get(VectorTy_7, const_packed_27_elems); -std::vector const_packed_29_elems; -const_packed_29_elems.push_back(const_int32_18); -const_packed_29_elems.push_back(const_int32_22); -ConstantInt* const_int32_30 = ConstantInt::get(APInt(32, "6", 10)); -const_packed_29_elems.push_back(const_int32_30); -const_packed_29_elems.push_back(const_int32_23); -Constant* const_packed_29 = ConstantVector::get(VectorTy_7, const_packed_29_elems); -std::vector const_packed_31_elems; -const_packed_31_elems.push_back(const_int32_18); -const_packed_31_elems.push_back(const_int32_22); -const_packed_31_elems.push_back(const_int32_24); -ConstantInt* const_int32_32 = ConstantInt::get(APInt(32, "7", 10)); -const_packed_31_elems.push_back(const_int32_32); -Constant* const_packed_31 = ConstantVector::get(VectorTy_7, const_packed_31_elems); -std::vector const_ptr_33_indices; -const_ptr_33_indices.push_back(const_int32_18); -const_ptr_33_indices.push_back(const_int32_18); -Constant* const_ptr_33 = ConstantExpr::getGetElementPtr(gvar_array__str, &const_ptr_33_indices[0], const_ptr_33_indices.size() ); -UndefValue* const_packed_34 = UndefValue::get(VectorTy_4); -std::vector const_ptr_35_indices; -const_ptr_35_indices.push_back(const_int32_18); -const_ptr_35_indices.push_back(const_int32_18); -Constant* const_ptr_35 = ConstantExpr::getGetElementPtr(gvar_array__str1, &const_ptr_35_indices[0], const_ptr_35_indices.size() ); +Constant* const_array_14 = ConstantArray::get("VEC IN is %f %f %f %f\x0A", true); +Constant* const_array_15 = ConstantArray::get("VEC OUT is %f %f %f %f\x0A", true); +ConstantFP* const_float_16 = ConstantFP::get(Type::FloatTy, APFloat(-1.280000e+02f)); +ConstantFP* const_float_17 = ConstantFP::get(Type::FloatTy, APFloat(1.280000e+02f)); +Constant* const_float_18 = Constant::getNullValue(Type::FloatTy); +Constant* const_int32_19 = Constant::getNullValue(IntegerType::get(32)); +std::vector const_packed_20_elems; +ConstantFP* const_float_21 = ConstantFP::get(Type::FloatTy, APFloat(1.000000e+00f)); +const_packed_20_elems.push_back(const_float_21); +UndefValue* const_float_22 = UndefValue::get(Type::FloatTy); +const_packed_20_elems.push_back(const_float_22); +const_packed_20_elems.push_back(const_float_22); +const_packed_20_elems.push_back(const_float_21); +Constant* const_packed_20 = ConstantVector::get(VectorTy_4, const_packed_20_elems); +ConstantInt* const_int32_23 = ConstantInt::get(APInt(32, "1", 10)); +ConstantInt* const_int32_24 = ConstantInt::get(APInt(32, "3", 10)); +ConstantInt* const_int32_25 = ConstantInt::get(APInt(32, "2", 10)); +std::vector const_packed_26_elems; +const_packed_26_elems.push_back(const_float_21); +const_packed_26_elems.push_back(const_float_18); +const_packed_26_elems.push_back(const_float_18); +const_packed_26_elems.push_back(const_float_21); +Constant* const_packed_26 = ConstantVector::get(VectorTy_4, const_packed_26_elems); +Constant* const_double_27 = Constant::getNullValue(Type::DoubleTy); +std::vector const_packed_28_elems; +const_packed_28_elems.push_back(const_int32_19); +ConstantInt* const_int32_29 = ConstantInt::get(APInt(32, "5", 10)); +const_packed_28_elems.push_back(const_int32_29); +const_packed_28_elems.push_back(const_int32_25); +const_packed_28_elems.push_back(const_int32_24); +Constant* const_packed_28 = ConstantVector::get(VectorTy_7, const_packed_28_elems); +std::vector const_packed_30_elems; +const_packed_30_elems.push_back(const_int32_19); +const_packed_30_elems.push_back(const_int32_23); +ConstantInt* const_int32_31 = ConstantInt::get(APInt(32, "6", 10)); +const_packed_30_elems.push_back(const_int32_31); +const_packed_30_elems.push_back(const_int32_24); +Constant* const_packed_30 = ConstantVector::get(VectorTy_7, const_packed_30_elems); +std::vector const_packed_32_elems; +const_packed_32_elems.push_back(const_int32_19); +const_packed_32_elems.push_back(const_int32_23); +const_packed_32_elems.push_back(const_int32_25); +ConstantInt* const_int32_33 = ConstantInt::get(APInt(32, "7", 10)); +const_packed_32_elems.push_back(const_int32_33); +Constant* const_packed_32 = ConstantVector::get(VectorTy_7, const_packed_32_elems); +std::vector const_ptr_34_indices; +const_ptr_34_indices.push_back(const_int32_19); +const_ptr_34_indices.push_back(const_int32_19); +Constant* const_ptr_34 = ConstantExpr::getGetElementPtr(gvar_array__str, &const_ptr_34_indices[0], const_ptr_34_indices.size() ); +UndefValue* const_packed_35 = UndefValue::get(VectorTy_4); +std::vector const_ptr_36_indices; +const_ptr_36_indices.push_back(const_int32_19); +const_ptr_36_indices.push_back(const_int32_19); +Constant* const_ptr_36 = ConstantExpr::getGetElementPtr(gvar_array__str1, &const_ptr_36_indices[0], const_ptr_36_indices.size() ); // Global Variable Definitions -gvar_array__str->setInitializer(const_array_13); -gvar_array__str1->setInitializer(const_array_14); +gvar_array__str->setInitializer(const_array_14); +gvar_array__str1->setInitializer(const_array_15); // Function Definitions @@ -224,12 +239,12 @@ gvar_array__str1->setInitializer(const_array_14); BasicBlock* label_entry = new BasicBlock("entry",func_approx,0); // Block entry (label_entry) - FCmpInst* int1_cmp = new FCmpInst(FCmpInst::FCMP_OLT, float_b, const_float_15, "cmp", label_entry); - SelectInst* float_b_addr_0 = new SelectInst(int1_cmp, const_float_15, float_b, "b.addr.0", label_entry); - FCmpInst* int1_cmp3 = new FCmpInst(FCmpInst::FCMP_OGT, float_b_addr_0, const_float_16, "cmp3", label_entry); - SelectInst* float_b_addr_1 = new SelectInst(int1_cmp3, const_float_16, float_b_addr_0, "b.addr.1", label_entry); - FCmpInst* int1_cmp7 = new FCmpInst(FCmpInst::FCMP_OLT, float_a, const_float_17, "cmp7", label_entry); - SelectInst* float_a_addr_0 = new SelectInst(int1_cmp7, const_float_17, float_a, "a.addr.0", label_entry); + FCmpInst* int1_cmp = new FCmpInst(FCmpInst::FCMP_OLT, float_b, const_float_16, "cmp", label_entry); + SelectInst* float_b_addr_0 = new SelectInst(int1_cmp, const_float_16, float_b, "b.addr.0", label_entry); + FCmpInst* int1_cmp3 = new FCmpInst(FCmpInst::FCMP_OGT, float_b_addr_0, const_float_17, "cmp3", label_entry); + SelectInst* float_b_addr_1 = new SelectInst(int1_cmp3, const_float_17, float_b_addr_0, "b.addr.1", label_entry); + FCmpInst* int1_cmp7 = new FCmpInst(FCmpInst::FCMP_OLT, float_a, const_float_18, "cmp7", label_entry); + SelectInst* float_a_addr_0 = new SelectInst(int1_cmp7, const_float_18, float_a, "a.addr.0", label_entry); std::vector float_call_params; float_call_params.push_back(float_a_addr_0); float_call_params.push_back(float_b_addr_1); @@ -246,36 +261,36 @@ gvar_array__str1->setInitializer(const_array_14); Value* packed_tmp = args++; packed_tmp->setName("tmp"); - BasicBlock* label_entry_37 = new BasicBlock("entry",func_lit,0); + BasicBlock* label_entry_38 = new BasicBlock("entry",func_lit,0); BasicBlock* label_ifthen = new BasicBlock("ifthen",func_lit,0); BasicBlock* label_UnifiedReturnBlock = new BasicBlock("UnifiedReturnBlock",func_lit,0); - // Block entry (label_entry_37) - ExtractElementInst* float_tmp7 = new ExtractElementInst(packed_tmp, const_int32_18, "tmp7", label_entry_37); - FCmpInst* int1_cmp_38 = new FCmpInst(FCmpInst::FCMP_OGT, float_tmp7, const_float_17, "cmp", label_entry_37); - new BranchInst(label_ifthen, label_UnifiedReturnBlock, int1_cmp_38, label_entry_37); + // Block entry (label_entry_38) + ExtractElementInst* float_tmp7 = new ExtractElementInst(packed_tmp, const_int32_19, "tmp7", label_entry_38); + FCmpInst* int1_cmp_39 = new FCmpInst(FCmpInst::FCMP_OGT, float_tmp7, const_float_18, "cmp", label_entry_38); + new BranchInst(label_ifthen, label_UnifiedReturnBlock, int1_cmp_39, label_entry_38); // Block ifthen (label_ifthen) - InsertElementInst* packed_tmp12 = new InsertElementInst(const_packed_19, float_tmp7, const_int32_22, "tmp12", label_ifthen); - ExtractElementInst* float_tmp14 = new ExtractElementInst(packed_tmp, const_int32_22, "tmp14", label_ifthen); - ExtractElementInst* float_tmp16 = new ExtractElementInst(packed_tmp, const_int32_23, "tmp16", label_ifthen); - FCmpInst* int1_cmp_i = new FCmpInst(FCmpInst::FCMP_OLT, float_tmp16, const_float_15, "cmp.i", label_ifthen); - SelectInst* float_b_addr_0_i = new SelectInst(int1_cmp_i, const_float_15, float_tmp16, "b.addr.0.i", label_ifthen); - FCmpInst* int1_cmp3_i = new FCmpInst(FCmpInst::FCMP_OGT, float_b_addr_0_i, const_float_16, "cmp3.i", label_ifthen); - SelectInst* float_b_addr_1_i = new SelectInst(int1_cmp3_i, const_float_16, float_b_addr_0_i, "b.addr.1.i", label_ifthen); - FCmpInst* int1_cmp7_i = new FCmpInst(FCmpInst::FCMP_OLT, float_tmp14, const_float_17, "cmp7.i", label_ifthen); - SelectInst* float_a_addr_0_i = new SelectInst(int1_cmp7_i, const_float_17, float_tmp14, "a.addr.0.i", label_ifthen); + InsertElementInst* packed_tmp12 = new InsertElementInst(const_packed_20, float_tmp7, const_int32_23, "tmp12", label_ifthen); + ExtractElementInst* float_tmp14 = new ExtractElementInst(packed_tmp, const_int32_23, "tmp14", label_ifthen); + ExtractElementInst* float_tmp16 = new ExtractElementInst(packed_tmp, const_int32_24, "tmp16", label_ifthen); + FCmpInst* int1_cmp_i = new FCmpInst(FCmpInst::FCMP_OLT, float_tmp16, const_float_16, "cmp.i", label_ifthen); + SelectInst* float_b_addr_0_i = new SelectInst(int1_cmp_i, const_float_16, float_tmp16, "b.addr.0.i", label_ifthen); + FCmpInst* int1_cmp3_i = new FCmpInst(FCmpInst::FCMP_OGT, float_b_addr_0_i, const_float_17, "cmp3.i", label_ifthen); + SelectInst* float_b_addr_1_i = new SelectInst(int1_cmp3_i, const_float_17, float_b_addr_0_i, "b.addr.1.i", label_ifthen); + FCmpInst* int1_cmp7_i = new FCmpInst(FCmpInst::FCMP_OLT, float_tmp14, const_float_18, "cmp7.i", label_ifthen); + SelectInst* float_a_addr_0_i = new SelectInst(int1_cmp7_i, const_float_18, float_tmp14, "a.addr.0.i", label_ifthen); std::vector float_call_i_params; float_call_i_params.push_back(float_a_addr_0_i); float_call_i_params.push_back(float_b_addr_1_i); CallInst* float_call_i = new CallInst(func_powf, float_call_i_params.begin(), float_call_i_params.end(), "call.i", label_ifthen); float_call_i->setCallingConv(CallingConv::C); float_call_i->setTailCall(true); - InsertElementInst* packed_tmp18 = new InsertElementInst(packed_tmp12, float_call_i, const_int32_24, "tmp18", label_ifthen); + InsertElementInst* packed_tmp18 = new InsertElementInst(packed_tmp12, float_call_i, const_int32_25, "tmp18", label_ifthen); new ReturnInst(packed_tmp18, label_ifthen); // Block UnifiedReturnBlock (label_UnifiedReturnBlock) - new ReturnInst(const_packed_25, label_UnifiedReturnBlock); + new ReturnInst(const_packed_26, label_UnifiedReturnBlock); } @@ -289,7 +304,7 @@ gvar_array__str1->setInitializer(const_array_14); Value* packed_tmp2 = args++; packed_tmp2->setName("tmp2"); - BasicBlock* label_entry_42 = new BasicBlock("entry",func_cmp,0); + BasicBlock* label_entry_43 = new BasicBlock("entry",func_cmp,0); BasicBlock* label_cond__14 = new BasicBlock("cond.?14",func_cmp,0); BasicBlock* label_cond_cont20 = new BasicBlock("cond.cont20",func_cmp,0); BasicBlock* label_cond__28 = new BasicBlock("cond.?28",func_cmp,0); @@ -297,28 +312,28 @@ gvar_array__str1->setInitializer(const_array_14); BasicBlock* label_cond__42 = new BasicBlock("cond.?42",func_cmp,0); BasicBlock* label_cond_cont48 = new BasicBlock("cond.cont48",func_cmp,0); - // Block entry (label_entry_42) - ExtractElementInst* float_tmp3 = new ExtractElementInst(packed_tmp0, const_int32_18, "tmp3", label_entry_42); - CastInst* double_conv = new FPExtInst(float_tmp3, Type::DoubleTy, "conv", label_entry_42); - FCmpInst* int1_cmp_43 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv, const_double_26, "cmp", label_entry_42); - ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp0, const_int32_22, "tmp11", label_entry_42); - CastInst* double_conv12 = new FPExtInst(float_tmp11, Type::DoubleTy, "conv12", label_entry_42); - FCmpInst* int1_cmp13 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv12, const_double_26, "cmp13", label_entry_42); - SelectInst* packed_tmp1_tmp2 = new SelectInst(int1_cmp_43, packed_tmp1, packed_tmp2, "tmp1.tmp2", label_entry_42); - new BranchInst(label_cond__14, label_cond_cont20, int1_cmp13, label_entry_42); + // Block entry (label_entry_43) + ExtractElementInst* float_tmp3 = new ExtractElementInst(packed_tmp0, const_int32_19, "tmp3", label_entry_43); + CastInst* double_conv = new FPExtInst(float_tmp3, Type::DoubleTy, "conv", label_entry_43); + FCmpInst* int1_cmp_44 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv, const_double_27, "cmp", label_entry_43); + ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp0, const_int32_23, "tmp11", label_entry_43); + CastInst* double_conv12 = new FPExtInst(float_tmp11, Type::DoubleTy, "conv12", label_entry_43); + FCmpInst* int1_cmp13 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv12, const_double_27, "cmp13", label_entry_43); + SelectInst* packed_tmp1_tmp2 = new SelectInst(int1_cmp_44, packed_tmp1, packed_tmp2, "tmp1.tmp2", label_entry_43); + new BranchInst(label_cond__14, label_cond_cont20, int1_cmp13, label_entry_43); // Block cond.?14 (label_cond__14) - ShuffleVectorInst* packed_tmp233 = new ShuffleVectorInst(packed_tmp1_tmp2, packed_tmp1, const_packed_27, "tmp233", label_cond__14); - ExtractElementInst* float_tmp254 = new ExtractElementInst(packed_tmp0, const_int32_24, "tmp254", label_cond__14); + ShuffleVectorInst* packed_tmp233 = new ShuffleVectorInst(packed_tmp1_tmp2, packed_tmp1, const_packed_28, "tmp233", label_cond__14); + ExtractElementInst* float_tmp254 = new ExtractElementInst(packed_tmp0, const_int32_25, "tmp254", label_cond__14); CastInst* double_conv265 = new FPExtInst(float_tmp254, Type::DoubleTy, "conv265", label_cond__14); - FCmpInst* int1_cmp276 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv265, const_double_26, "cmp276", label_cond__14); + FCmpInst* int1_cmp276 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv265, const_double_27, "cmp276", label_cond__14); new BranchInst(label_cond__28, label_cond_cont34, int1_cmp276, label_cond__14); // Block cond.cont20 (label_cond_cont20) - ShuffleVectorInst* packed_tmp23 = new ShuffleVectorInst(packed_tmp1_tmp2, packed_tmp2, const_packed_27, "tmp23", label_cond_cont20); - ExtractElementInst* float_tmp25 = new ExtractElementInst(packed_tmp0, const_int32_24, "tmp25", label_cond_cont20); + ShuffleVectorInst* packed_tmp23 = new ShuffleVectorInst(packed_tmp1_tmp2, packed_tmp2, const_packed_28, "tmp23", label_cond_cont20); + ExtractElementInst* float_tmp25 = new ExtractElementInst(packed_tmp0, const_int32_25, "tmp25", label_cond_cont20); CastInst* double_conv26 = new FPExtInst(float_tmp25, Type::DoubleTy, "conv26", label_cond_cont20); - FCmpInst* int1_cmp27 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv26, const_double_26, "cmp27", label_cond_cont20); + FCmpInst* int1_cmp27 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv26, const_double_27, "cmp27", label_cond_cont20); new BranchInst(label_cond__28, label_cond_cont34, int1_cmp27, label_cond_cont20); // Block cond.?28 (label_cond__28) @@ -327,10 +342,10 @@ gvar_array__str1->setInitializer(const_array_14); packed_tmp23_reg2mem_0->addIncoming(packed_tmp233, label_cond__14); packed_tmp23_reg2mem_0->addIncoming(packed_tmp23, label_cond_cont20); - ShuffleVectorInst* packed_tmp378 = new ShuffleVectorInst(packed_tmp23_reg2mem_0, packed_tmp1, const_packed_29, "tmp378", label_cond__28); - ExtractElementInst* float_tmp399 = new ExtractElementInst(packed_tmp0, const_int32_23, "tmp399", label_cond__28); + ShuffleVectorInst* packed_tmp378 = new ShuffleVectorInst(packed_tmp23_reg2mem_0, packed_tmp1, const_packed_30, "tmp378", label_cond__28); + ExtractElementInst* float_tmp399 = new ExtractElementInst(packed_tmp0, const_int32_24, "tmp399", label_cond__28); CastInst* double_conv4010 = new FPExtInst(float_tmp399, Type::DoubleTy, "conv4010", label_cond__28); - FCmpInst* int1_cmp4111 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv4010, const_double_26, "cmp4111", label_cond__28); + FCmpInst* int1_cmp4111 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv4010, const_double_27, "cmp4111", label_cond__28); new BranchInst(label_cond__42, label_cond_cont48, int1_cmp4111, label_cond__28); // Block cond.cont34 (label_cond_cont34) @@ -339,10 +354,10 @@ gvar_array__str1->setInitializer(const_array_14); packed_tmp23_reg2mem_1->addIncoming(packed_tmp233, label_cond__14); packed_tmp23_reg2mem_1->addIncoming(packed_tmp23, label_cond_cont20); - ShuffleVectorInst* packed_tmp37 = new ShuffleVectorInst(packed_tmp23_reg2mem_1, packed_tmp2, const_packed_29, "tmp37", label_cond_cont34); - ExtractElementInst* float_tmp39 = new ExtractElementInst(packed_tmp0, const_int32_23, "tmp39", label_cond_cont34); + ShuffleVectorInst* packed_tmp37 = new ShuffleVectorInst(packed_tmp23_reg2mem_1, packed_tmp2, const_packed_30, "tmp37", label_cond_cont34); + ExtractElementInst* float_tmp39 = new ExtractElementInst(packed_tmp0, const_int32_24, "tmp39", label_cond_cont34); CastInst* double_conv40 = new FPExtInst(float_tmp39, Type::DoubleTy, "conv40", label_cond_cont34); - FCmpInst* int1_cmp41 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv40, const_double_26, "cmp41", label_cond_cont34); + FCmpInst* int1_cmp41 = new FCmpInst(FCmpInst::FCMP_OLT, double_conv40, const_double_27, "cmp41", label_cond_cont34); new BranchInst(label_cond__42, label_cond_cont48, int1_cmp41, label_cond_cont34); // Block cond.?42 (label_cond__42) @@ -351,7 +366,7 @@ gvar_array__str1->setInitializer(const_array_14); packed_tmp37_reg2mem_0->addIncoming(packed_tmp378, label_cond__28); packed_tmp37_reg2mem_0->addIncoming(packed_tmp37, label_cond_cont34); - ShuffleVectorInst* packed_tmp5113 = new ShuffleVectorInst(packed_tmp37_reg2mem_0, packed_tmp1, const_packed_31, "tmp5113", label_cond__42); + ShuffleVectorInst* packed_tmp5113 = new ShuffleVectorInst(packed_tmp37_reg2mem_0, packed_tmp1, const_packed_32, "tmp5113", label_cond__42); new ReturnInst(packed_tmp5113, label_cond__42); // Block cond.cont48 (label_cond_cont48) @@ -360,7 +375,7 @@ gvar_array__str1->setInitializer(const_array_14); packed_tmp37_reg2mem_1->addIncoming(packed_tmp378, label_cond__28); packed_tmp37_reg2mem_1->addIncoming(packed_tmp37, label_cond_cont34); - ShuffleVectorInst* packed_tmp51 = new ShuffleVectorInst(packed_tmp37_reg2mem_1, packed_tmp2, const_packed_31, "tmp51", label_cond_cont48); + ShuffleVectorInst* packed_tmp51 = new ShuffleVectorInst(packed_tmp37_reg2mem_1, packed_tmp2, const_packed_32, "tmp51", label_cond_cont48); new ReturnInst(packed_tmp51, label_cond_cont48); } @@ -371,87 +386,125 @@ gvar_array__str1->setInitializer(const_array_14); Value* packed_val = args++; packed_val->setName("val"); - BasicBlock* label_entry_51 = new BasicBlock("entry",func_vcos,0); - - // Block entry (label_entry_51) - ExtractElementInst* float_tmp1 = new ExtractElementInst(packed_val, const_int32_18, "tmp1", label_entry_51); - CastInst* double_conv_52 = new FPExtInst(float_tmp1, Type::DoubleTy, "conv", label_entry_51); - ExtractElementInst* float_tmp3_53 = new ExtractElementInst(packed_val, const_int32_22, "tmp3", label_entry_51); - CastInst* double_conv4 = new FPExtInst(float_tmp3_53, Type::DoubleTy, "conv4", label_entry_51); - ExtractElementInst* float_tmp6 = new ExtractElementInst(packed_val, const_int32_24, "tmp6", label_entry_51); - CastInst* double_conv7 = new FPExtInst(float_tmp6, Type::DoubleTy, "conv7", label_entry_51); - ExtractElementInst* float_tmp9 = new ExtractElementInst(packed_val, const_int32_23, "tmp9", label_entry_51); - CastInst* double_conv10 = new FPExtInst(float_tmp9, Type::DoubleTy, "conv10", label_entry_51); + BasicBlock* label_entry_52 = new BasicBlock("entry",func_vcos,0); + + // Block entry (label_entry_52) + ExtractElementInst* float_tmp1 = new ExtractElementInst(packed_val, const_int32_19, "tmp1", label_entry_52); + CastInst* double_conv_53 = new FPExtInst(float_tmp1, Type::DoubleTy, "conv", label_entry_52); + ExtractElementInst* float_tmp3_54 = new ExtractElementInst(packed_val, const_int32_23, "tmp3", label_entry_52); + CastInst* double_conv4 = new FPExtInst(float_tmp3_54, Type::DoubleTy, "conv4", label_entry_52); + ExtractElementInst* float_tmp6 = new ExtractElementInst(packed_val, const_int32_25, "tmp6", label_entry_52); + CastInst* double_conv7 = new FPExtInst(float_tmp6, Type::DoubleTy, "conv7", label_entry_52); + ExtractElementInst* float_tmp9 = new ExtractElementInst(packed_val, const_int32_24, "tmp9", label_entry_52); + CastInst* double_conv10 = new FPExtInst(float_tmp9, Type::DoubleTy, "conv10", label_entry_52); std::vector int32_call_params; - int32_call_params.push_back(const_ptr_33); - int32_call_params.push_back(double_conv_52); + int32_call_params.push_back(const_ptr_34); + int32_call_params.push_back(double_conv_53); int32_call_params.push_back(double_conv4); int32_call_params.push_back(double_conv7); int32_call_params.push_back(double_conv10); - CallInst* int32_call = new CallInst(func_printf, int32_call_params.begin(), int32_call_params.end(), "call", label_entry_51); + CallInst* int32_call = new CallInst(func_printf, int32_call_params.begin(), int32_call_params.end(), "call", label_entry_52); int32_call->setCallingConv(CallingConv::C); int32_call->setTailCall(true); - CallInst* float_call13 = new CallInst(func_cosf, float_tmp1, "call13", label_entry_51); + CallInst* float_call13 = new CallInst(func_cosf, float_tmp1, "call13", label_entry_52); float_call13->setCallingConv(CallingConv::C); float_call13->setTailCall(true); - InsertElementInst* packed_tmp15 = new InsertElementInst(const_packed_34, float_call13, const_int32_18, "tmp15", label_entry_51); - InsertElementInst* packed_tmp20 = new InsertElementInst(packed_tmp15, float_call13, const_int32_22, "tmp20", label_entry_51); - InsertElementInst* packed_tmp25 = new InsertElementInst(packed_tmp20, float_call13, const_int32_24, "tmp25", label_entry_51); - InsertElementInst* packed_tmp30 = new InsertElementInst(packed_tmp25, float_call13, const_int32_23, "tmp30", label_entry_51); - CastInst* double_conv33 = new FPExtInst(float_call13, Type::DoubleTy, "conv33", label_entry_51); + InsertElementInst* packed_tmp15 = new InsertElementInst(const_packed_35, float_call13, const_int32_19, "tmp15", label_entry_52); + InsertElementInst* packed_tmp20 = new InsertElementInst(packed_tmp15, float_call13, const_int32_23, "tmp20", label_entry_52); + InsertElementInst* packed_tmp25 = new InsertElementInst(packed_tmp20, float_call13, const_int32_25, "tmp25", label_entry_52); + InsertElementInst* packed_tmp30 = new InsertElementInst(packed_tmp25, float_call13, const_int32_24, "tmp30", label_entry_52); + CastInst* double_conv33 = new FPExtInst(float_call13, Type::DoubleTy, "conv33", label_entry_52); std::vector int32_call43_params; - int32_call43_params.push_back(const_ptr_35); + int32_call43_params.push_back(const_ptr_36); int32_call43_params.push_back(double_conv33); int32_call43_params.push_back(double_conv33); int32_call43_params.push_back(double_conv33); int32_call43_params.push_back(double_conv33); - CallInst* int32_call43 = new CallInst(func_printf, int32_call43_params.begin(), int32_call43_params.end(), "call43", label_entry_51); + CallInst* int32_call43 = new CallInst(func_printf, int32_call43_params.begin(), int32_call43_params.end(), "call43", label_entry_52); int32_call43->setCallingConv(CallingConv::C); int32_call43->setTailCall(true); - new ReturnInst(packed_tmp30, label_entry_51); + new ReturnInst(packed_tmp30, label_entry_52); } // Function: scs (func_scs) { Function::arg_iterator args = func_scs->arg_begin(); - Value* packed_val_55 = args++; - packed_val_55->setName("val"); - - BasicBlock* label_entry_56 = new BasicBlock("entry",func_scs,0); - - // Block entry (label_entry_56) - ExtractElementInst* float_tmp2 = new ExtractElementInst(packed_val_55, const_int32_18, "tmp2", label_entry_56); - CallInst* float_call_57 = new CallInst(func_cosf, float_tmp2, "call", label_entry_56); - float_call_57->setCallingConv(CallingConv::C); - float_call_57->setTailCall(true); - InsertElementInst* packed_tmp5 = new InsertElementInst(const_packed_34, float_call_57, const_int32_18, "tmp5", label_entry_56); - CallInst* float_call7 = new CallInst(func_sinf, float_tmp2, "call7", label_entry_56); + Value* packed_val_56 = args++; + packed_val_56->setName("val"); + + BasicBlock* label_entry_57 = new BasicBlock("entry",func_scs,0); + + // Block entry (label_entry_57) + ExtractElementInst* float_tmp2 = new ExtractElementInst(packed_val_56, const_int32_19, "tmp2", label_entry_57); + CallInst* float_call_58 = new CallInst(func_cosf, float_tmp2, "call", label_entry_57); + float_call_58->setCallingConv(CallingConv::C); + float_call_58->setTailCall(true); + InsertElementInst* packed_tmp5 = new InsertElementInst(const_packed_35, float_call_58, const_int32_19, "tmp5", label_entry_57); + CallInst* float_call7 = new CallInst(func_sinf, float_tmp2, "call7", label_entry_57); float_call7->setCallingConv(CallingConv::C); float_call7->setTailCall(true); - InsertElementInst* packed_tmp9 = new InsertElementInst(packed_tmp5, float_call7, const_int32_22, "tmp9", label_entry_56); - new ReturnInst(packed_tmp9, label_entry_56); + InsertElementInst* packed_tmp9 = new InsertElementInst(packed_tmp5, float_call7, const_int32_23, "tmp9", label_entry_57); + new ReturnInst(packed_tmp9, label_entry_57); } // Function: vsin (func_vsin) { Function::arg_iterator args = func_vsin->arg_begin(); - Value* packed_val_59 = args++; - packed_val_59->setName("val"); - - BasicBlock* label_entry_60 = new BasicBlock("entry",func_vsin,0); - - // Block entry (label_entry_60) - ExtractElementInst* float_tmp2_61 = new ExtractElementInst(packed_val_59, const_int32_18, "tmp2", label_entry_60); - CallInst* float_call_62 = new CallInst(func_sinf, float_tmp2_61, "call", label_entry_60); - float_call_62->setCallingConv(CallingConv::C); - float_call_62->setTailCall(true); - InsertElementInst* packed_tmp6 = new InsertElementInst(const_packed_34, float_call_62, const_int32_18, "tmp6", label_entry_60); - InsertElementInst* packed_tmp9_63 = new InsertElementInst(packed_tmp6, float_call_62, const_int32_22, "tmp9", label_entry_60); - InsertElementInst* packed_tmp12_64 = new InsertElementInst(packed_tmp9_63, float_call_62, const_int32_24, "tmp12", label_entry_60); - InsertElementInst* packed_tmp15_65 = new InsertElementInst(packed_tmp12_64, float_call_62, const_int32_23, "tmp15", label_entry_60); - new ReturnInst(packed_tmp15_65, label_entry_60); + Value* packed_val_60 = args++; + packed_val_60->setName("val"); + + BasicBlock* label_entry_61 = new BasicBlock("entry",func_vsin,0); + + // Block entry (label_entry_61) + ExtractElementInst* float_tmp2_62 = new ExtractElementInst(packed_val_60, const_int32_19, "tmp2", label_entry_61); + CallInst* float_call_63 = new CallInst(func_sinf, float_tmp2_62, "call", label_entry_61); + float_call_63->setCallingConv(CallingConv::C); + float_call_63->setTailCall(true); + InsertElementInst* packed_tmp6 = new InsertElementInst(const_packed_35, float_call_63, const_int32_19, "tmp6", label_entry_61); + InsertElementInst* packed_tmp9_64 = new InsertElementInst(packed_tmp6, float_call_63, const_int32_23, "tmp9", label_entry_61); + InsertElementInst* packed_tmp12_65 = new InsertElementInst(packed_tmp9_64, float_call_63, const_int32_25, "tmp12", label_entry_61); + InsertElementInst* packed_tmp15_66 = new InsertElementInst(packed_tmp12_65, float_call_63, const_int32_24, "tmp15", label_entry_61); + new ReturnInst(packed_tmp15_66, label_entry_61); + +} + +// Function: kilp (func_kilp) +{ + Function::arg_iterator args = func_kilp->arg_begin(); + Value* packed_val_68 = args++; + packed_val_68->setName("val"); + + BasicBlock* label_entry_69 = new BasicBlock("entry",func_kilp,0); + BasicBlock* label_lor_rhs = new BasicBlock("lor_rhs",func_kilp,0); + BasicBlock* label_lor_rhs6 = new BasicBlock("lor_rhs6",func_kilp,0); + BasicBlock* label_lor_rhs13 = new BasicBlock("lor_rhs13",func_kilp,0); + BasicBlock* label_UnifiedReturnBlock_70 = new BasicBlock("UnifiedReturnBlock",func_kilp,0); + + // Block entry (label_entry_69) + ExtractElementInst* float_tmp1_71 = new ExtractElementInst(packed_val_68, const_int32_19, "tmp1", label_entry_69); + FCmpInst* int1_cmp_72 = new FCmpInst(FCmpInst::FCMP_OLT, float_tmp1_71, const_float_18, "cmp", label_entry_69); + new BranchInst(label_UnifiedReturnBlock_70, label_lor_rhs, int1_cmp_72, label_entry_69); + + // Block lor_rhs (label_lor_rhs) + ExtractElementInst* float_tmp3_74 = new ExtractElementInst(packed_val_68, const_int32_23, "tmp3", label_lor_rhs); + FCmpInst* int1_cmp5 = new FCmpInst(FCmpInst::FCMP_OLT, float_tmp3_74, const_float_18, "cmp5", label_lor_rhs); + new BranchInst(label_UnifiedReturnBlock_70, label_lor_rhs6, int1_cmp5, label_lor_rhs); + + // Block lor_rhs6 (label_lor_rhs6) + ExtractElementInst* float_tmp8 = new ExtractElementInst(packed_val_68, const_int32_25, "tmp8", label_lor_rhs6); + FCmpInst* int1_cmp10 = new FCmpInst(FCmpInst::FCMP_OLT, float_tmp8, const_float_18, "cmp10", label_lor_rhs6); + new BranchInst(label_UnifiedReturnBlock_70, label_lor_rhs13, int1_cmp10, label_lor_rhs6); + + // Block lor_rhs13 (label_lor_rhs13) + ExtractElementInst* float_tmp15 = new ExtractElementInst(packed_val_68, const_int32_24, "tmp15", label_lor_rhs13); + FCmpInst* int1_cmp17 = new FCmpInst(FCmpInst::FCMP_OLT, float_tmp15, const_float_18, "cmp17", label_lor_rhs13); + CastInst* int32_retval = new ZExtInst(int1_cmp17, IntegerType::get(32), "retval", label_lor_rhs13); + new ReturnInst(int32_retval, label_lor_rhs13); + + // Block UnifiedReturnBlock (label_UnifiedReturnBlock_70) + new ReturnInst(const_int32_23, label_UnifiedReturnBlock_70); } diff --git a/src/mesa/pipe/llvm/instructions.cpp b/src/mesa/pipe/llvm/instructions.cpp index 7a70aec878..c8d1992587 100644 --- a/src/mesa/pipe/llvm/instructions.cpp +++ b/src/mesa/pipe/llvm/instructions.cpp @@ -864,6 +864,15 @@ llvm::Value * Instructions::scs(llvm::Value *in) return call; } +llvm::Value * Instructions::kilp(llvm::Value *in) +{ + llvm::Function *func = m_mod->getFunction("kilp"); + assert(func); + + CallInst *call = m_builder.CreateCall(func, in, name("kilpres")); + call->setTailCall(false); + return call; +} llvm::Value * Instructions::sin(llvm::Value *in) { @@ -876,3 +885,4 @@ llvm::Value * Instructions::sin(llvm::Value *in) } #endif //MESA_LLVM + diff --git a/src/mesa/pipe/llvm/instructions.h b/src/mesa/pipe/llvm/instructions.h index c31cc4f125..9ebc17dd8e 100644 --- a/src/mesa/pipe/llvm/instructions.h +++ b/src/mesa/pipe/llvm/instructions.h @@ -79,6 +79,7 @@ public: llvm::Value *floor(llvm::Value *in); llvm::Value *frc(llvm::Value *in); void ifop(llvm::Value *in); + llvm::Value *kilp(llvm::Value *in); llvm::Value *lerp(llvm::Value *in1, llvm::Value *in2, llvm::Value *in3); llvm::Value *lit(llvm::Value *in); diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp index 6e7fa32807..82ad6cfa26 100644 --- a/src/mesa/pipe/llvm/llvm_base_shader.cpp +++ b/src/mesa/pipe/llvm/llvm_base_shader.cpp @@ -810,246 +810,257 @@ Module* createBaseShader() { AllocaInst* ptr_results_142 = new AllocaInst(ArrayTy_33, "results", label_entry_134); AllocaInst* ptr_temps_143 = new AllocaInst(ArrayTy_25, "temps", label_entry_134); AllocaInst* ptr_args_144 = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_134); - ICmpInst* int1_cmp5_i_145 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_inputs_131, const_int32_34, "cmp5.i", label_entry_134); - new BranchInst(label_forbody6_i_135, label_from_array_exit_136, int1_cmp5_i_145, label_entry_134); + std::vector ptr_tmp_indices; + ptr_tmp_indices.push_back(const_int32_34); + ptr_tmp_indices.push_back(const_int32_39); + Instruction* ptr_tmp = new GetElementPtrInst(ptr_args_144, ptr_tmp_indices.begin(), ptr_tmp_indices.end(), "tmp", label_entry_134); + StoreInst* void_145 = new StoreInst(const_int32_34, ptr_tmp, false, label_entry_134); + ICmpInst* int1_cmp5_i_146 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_inputs_131, const_int32_34, "cmp5.i", label_entry_134); + new BranchInst(label_forbody6_i_135, label_from_array_exit_136, int1_cmp5_i_146, label_entry_134); // Block forbody6.i (label_forbody6_i_135) - Argument* fwdref_148 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0_i_147 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i", label_forbody6_i_135); - int32_j_0_reg2mem_0_i_147->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_147->addIncoming(const_int32_34, label_entry_134); - int32_j_0_reg2mem_0_i_147->addIncoming(fwdref_148, label_forbody6_i_135); - - Argument* fwdref_150 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i_149 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody6_i_135); - packed_vec_0_reg2mem_0_i_149->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_149->addIncoming(const_packed_35, label_entry_134); - packed_vec_0_reg2mem_0_i_149->addIncoming(fwdref_150, label_forbody6_i_135); - - std::vector ptr_arraydecay11_i_151_indices; - ptr_arraydecay11_i_151_indices.push_back(const_int32_34); - ptr_arraydecay11_i_151_indices.push_back(int32_j_0_reg2mem_0_i_147); - ptr_arraydecay11_i_151_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay11_i_151 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_151_indices.begin(), ptr_arraydecay11_i_151_indices.end(), "arraydecay11.i", label_forbody6_i_135); - LoadInst* float_tmp13_i_152 = new LoadInst(ptr_arraydecay11_i_151, "tmp13.i", false, label_forbody6_i_135); - InsertElementInst* packed_tmp15_i_153 = new InsertElementInst(packed_vec_0_reg2mem_0_i_149, float_tmp13_i_152, const_int32_34, "tmp15.i", label_forbody6_i_135); - std::vector ptr_arrayidx23_i_154_indices; - ptr_arrayidx23_i_154_indices.push_back(const_int32_34); - ptr_arrayidx23_i_154_indices.push_back(int32_j_0_reg2mem_0_i_147); - ptr_arrayidx23_i_154_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx23_i_154 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_154_indices.begin(), ptr_arrayidx23_i_154_indices.end(), "arrayidx23.i", label_forbody6_i_135); - LoadInst* float_tmp24_i_155 = new LoadInst(ptr_arrayidx23_i_154, "tmp24.i", false, label_forbody6_i_135); - InsertElementInst* packed_tmp26_i_156 = new InsertElementInst(packed_tmp15_i_153, float_tmp24_i_155, const_int32_36, "tmp26.i", label_forbody6_i_135); - std::vector ptr_arrayidx34_i_157_indices; - ptr_arrayidx34_i_157_indices.push_back(const_int32_34); - ptr_arrayidx34_i_157_indices.push_back(int32_j_0_reg2mem_0_i_147); - ptr_arrayidx34_i_157_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx34_i_157 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_157_indices.begin(), ptr_arrayidx34_i_157_indices.end(), "arrayidx34.i", label_forbody6_i_135); - LoadInst* float_tmp35_i_158 = new LoadInst(ptr_arrayidx34_i_157, "tmp35.i", false, label_forbody6_i_135); - InsertElementInst* packed_tmp37_i_159 = new InsertElementInst(packed_tmp26_i_156, float_tmp35_i_158, const_int32_37, "tmp37.i", label_forbody6_i_135); - std::vector ptr_arrayidx45_i_160_indices; - ptr_arrayidx45_i_160_indices.push_back(const_int32_34); - ptr_arrayidx45_i_160_indices.push_back(int32_j_0_reg2mem_0_i_147); - ptr_arrayidx45_i_160_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx45_i_160 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_160_indices.begin(), ptr_arrayidx45_i_160_indices.end(), "arrayidx45.i", label_forbody6_i_135); - LoadInst* float_tmp46_i_161 = new LoadInst(ptr_arrayidx45_i_160, "tmp46.i", false, label_forbody6_i_135); - InsertElementInst* packed_tmp48_i_162 = new InsertElementInst(packed_tmp37_i_159, float_tmp46_i_161, const_int32_38, "tmp48.i", label_forbody6_i_135); - std::vector ptr_arrayidx54_i_163_indices; - ptr_arrayidx54_i_163_indices.push_back(const_int32_34); - ptr_arrayidx54_i_163_indices.push_back(const_int32_34); - ptr_arrayidx54_i_163_indices.push_back(int32_j_0_reg2mem_0_i_147); - Instruction* ptr_arrayidx54_i_163 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_163_indices.begin(), ptr_arrayidx54_i_163_indices.end(), "arrayidx54.i", label_forbody6_i_135); - StoreInst* void_164 = new StoreInst(packed_tmp48_i_162, ptr_arrayidx54_i_163, false, label_forbody6_i_135); - BinaryOperator* int32_inc_i_165 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_147, const_int32_36, "inc.i", label_forbody6_i_135); - ICmpInst* int1_cmp59_i_166 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_165, int32_num_inputs_131, "cmp59.i", label_forbody6_i_135); - new BranchInst(label_forbody6_i_135, label_forbody6_i_1, int1_cmp59_i_166, label_forbody6_i_135); + Argument* fwdref_149 = new Argument(IntegerType::get(32)); + PHINode* int32_j_0_reg2mem_0_i_148 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i", label_forbody6_i_135); + int32_j_0_reg2mem_0_i_148->reserveOperandSpace(2); + int32_j_0_reg2mem_0_i_148->addIncoming(const_int32_34, label_entry_134); + int32_j_0_reg2mem_0_i_148->addIncoming(fwdref_149, label_forbody6_i_135); + + Argument* fwdref_151 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i_150 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody6_i_135); + packed_vec_0_reg2mem_0_i_150->reserveOperandSpace(2); + packed_vec_0_reg2mem_0_i_150->addIncoming(const_packed_35, label_entry_134); + packed_vec_0_reg2mem_0_i_150->addIncoming(fwdref_151, label_forbody6_i_135); + + std::vector ptr_arraydecay11_i_152_indices; + ptr_arraydecay11_i_152_indices.push_back(const_int32_34); + ptr_arraydecay11_i_152_indices.push_back(int32_j_0_reg2mem_0_i_148); + ptr_arraydecay11_i_152_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay11_i_152 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_152_indices.begin(), ptr_arraydecay11_i_152_indices.end(), "arraydecay11.i", label_forbody6_i_135); + LoadInst* float_tmp13_i_153 = new LoadInst(ptr_arraydecay11_i_152, "tmp13.i", false, label_forbody6_i_135); + InsertElementInst* packed_tmp15_i_154 = new InsertElementInst(packed_vec_0_reg2mem_0_i_150, float_tmp13_i_153, const_int32_34, "tmp15.i", label_forbody6_i_135); + std::vector ptr_arrayidx23_i_155_indices; + ptr_arrayidx23_i_155_indices.push_back(const_int32_34); + ptr_arrayidx23_i_155_indices.push_back(int32_j_0_reg2mem_0_i_148); + ptr_arrayidx23_i_155_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx23_i_155 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_155_indices.begin(), ptr_arrayidx23_i_155_indices.end(), "arrayidx23.i", label_forbody6_i_135); + LoadInst* float_tmp24_i_156 = new LoadInst(ptr_arrayidx23_i_155, "tmp24.i", false, label_forbody6_i_135); + InsertElementInst* packed_tmp26_i_157 = new InsertElementInst(packed_tmp15_i_154, float_tmp24_i_156, const_int32_36, "tmp26.i", label_forbody6_i_135); + std::vector ptr_arrayidx34_i_158_indices; + ptr_arrayidx34_i_158_indices.push_back(const_int32_34); + ptr_arrayidx34_i_158_indices.push_back(int32_j_0_reg2mem_0_i_148); + ptr_arrayidx34_i_158_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx34_i_158 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_158_indices.begin(), ptr_arrayidx34_i_158_indices.end(), "arrayidx34.i", label_forbody6_i_135); + LoadInst* float_tmp35_i_159 = new LoadInst(ptr_arrayidx34_i_158, "tmp35.i", false, label_forbody6_i_135); + InsertElementInst* packed_tmp37_i_160 = new InsertElementInst(packed_tmp26_i_157, float_tmp35_i_159, const_int32_37, "tmp37.i", label_forbody6_i_135); + std::vector ptr_arrayidx45_i_161_indices; + ptr_arrayidx45_i_161_indices.push_back(const_int32_34); + ptr_arrayidx45_i_161_indices.push_back(int32_j_0_reg2mem_0_i_148); + ptr_arrayidx45_i_161_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx45_i_161 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_161_indices.begin(), ptr_arrayidx45_i_161_indices.end(), "arrayidx45.i", label_forbody6_i_135); + LoadInst* float_tmp46_i_162 = new LoadInst(ptr_arrayidx45_i_161, "tmp46.i", false, label_forbody6_i_135); + InsertElementInst* packed_tmp48_i_163 = new InsertElementInst(packed_tmp37_i_160, float_tmp46_i_162, const_int32_38, "tmp48.i", label_forbody6_i_135); + std::vector ptr_arrayidx54_i_164_indices; + ptr_arrayidx54_i_164_indices.push_back(const_int32_34); + ptr_arrayidx54_i_164_indices.push_back(const_int32_34); + ptr_arrayidx54_i_164_indices.push_back(int32_j_0_reg2mem_0_i_148); + Instruction* ptr_arrayidx54_i_164 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_164_indices.begin(), ptr_arrayidx54_i_164_indices.end(), "arrayidx54.i", label_forbody6_i_135); + StoreInst* void_165 = new StoreInst(packed_tmp48_i_163, ptr_arrayidx54_i_164, false, label_forbody6_i_135); + BinaryOperator* int32_inc_i_166 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_148, const_int32_36, "inc.i", label_forbody6_i_135); + ICmpInst* int1_cmp59_i_167 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_166, int32_num_inputs_131, "cmp59.i", label_forbody6_i_135); + new BranchInst(label_forbody6_i_135, label_forbody6_i_1, int1_cmp59_i_167, label_forbody6_i_135); // Block from_array.exit (label_from_array_exit_136) - ICmpInst* int1_cmp_i_168 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_133, const_int32_34, "cmp.i", label_from_array_exit_136); - new BranchInst(label_forbody_i13, label_from_consts_exit_137, int1_cmp_i_168, label_from_array_exit_136); + ICmpInst* int1_cmp_i_169 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_133, const_int32_34, "cmp.i", label_from_array_exit_136); + new BranchInst(label_forbody_i13, label_from_consts_exit_137, int1_cmp_i_169, label_from_array_exit_136); // Block forbody.i13 (label_forbody_i13) - Argument* fwdref_170 = new Argument(IntegerType::get(32)); + Argument* fwdref_171 = new Argument(IntegerType::get(32)); PHINode* int32_i_0_reg2mem_0_i3 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i3", label_forbody_i13); int32_i_0_reg2mem_0_i3->reserveOperandSpace(2); int32_i_0_reg2mem_0_i3->addIncoming(const_int32_34, label_from_array_exit_136); - int32_i_0_reg2mem_0_i3->addIncoming(fwdref_170, label_forbody_i13); + int32_i_0_reg2mem_0_i3->addIncoming(fwdref_171, label_forbody_i13); - Argument* fwdref_171 = new Argument(VectorTy_1); + Argument* fwdref_172 = new Argument(VectorTy_1); PHINode* packed_vec_0_reg2mem_0_i4 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i4", label_forbody_i13); packed_vec_0_reg2mem_0_i4->reserveOperandSpace(2); packed_vec_0_reg2mem_0_i4->addIncoming(const_packed_35, label_from_array_exit_136); - packed_vec_0_reg2mem_0_i4->addIncoming(fwdref_171, label_forbody_i13); + packed_vec_0_reg2mem_0_i4->addIncoming(fwdref_172, label_forbody_i13); std::vector ptr_arraydecay_i5_indices; ptr_arraydecay_i5_indices.push_back(int32_i_0_reg2mem_0_i3); ptr_arraydecay_i5_indices.push_back(const_int32_34); Instruction* ptr_arraydecay_i5 = new GetElementPtrInst(ptr_aconsts_132, ptr_arraydecay_i5_indices.begin(), ptr_arraydecay_i5_indices.end(), "arraydecay.i5", label_forbody_i13); - LoadInst* float_tmp5_i_172 = new LoadInst(ptr_arraydecay_i5, "tmp5.i", false, label_forbody_i13); - InsertElementInst* packed_tmp7_i6 = new InsertElementInst(packed_vec_0_reg2mem_0_i4, float_tmp5_i_172, const_int32_34, "tmp7.i6", label_forbody_i13); - std::vector ptr_arrayidx12_i_173_indices; - ptr_arrayidx12_i_173_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx12_i_173_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx12_i_173 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx12_i_173_indices.begin(), ptr_arrayidx12_i_173_indices.end(), "arrayidx12.i", label_forbody_i13); - LoadInst* float_tmp13_i7 = new LoadInst(ptr_arrayidx12_i_173, "tmp13.i7", false, label_forbody_i13); + LoadInst* float_tmp5_i_173 = new LoadInst(ptr_arraydecay_i5, "tmp5.i", false, label_forbody_i13); + InsertElementInst* packed_tmp7_i6 = new InsertElementInst(packed_vec_0_reg2mem_0_i4, float_tmp5_i_173, const_int32_34, "tmp7.i6", label_forbody_i13); + std::vector ptr_arrayidx12_i_174_indices; + ptr_arrayidx12_i_174_indices.push_back(int32_i_0_reg2mem_0_i3); + ptr_arrayidx12_i_174_indices.push_back(const_int32_36); + Instruction* ptr_arrayidx12_i_174 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx12_i_174_indices.begin(), ptr_arrayidx12_i_174_indices.end(), "arrayidx12.i", label_forbody_i13); + LoadInst* float_tmp13_i7 = new LoadInst(ptr_arrayidx12_i_174, "tmp13.i7", false, label_forbody_i13); InsertElementInst* packed_tmp15_i8 = new InsertElementInst(packed_tmp7_i6, float_tmp13_i7, const_int32_36, "tmp15.i8", label_forbody_i13); - std::vector ptr_arrayidx20_i_174_indices; - ptr_arrayidx20_i_174_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx20_i_174_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx20_i_174 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx20_i_174_indices.begin(), ptr_arrayidx20_i_174_indices.end(), "arrayidx20.i", label_forbody_i13); - LoadInst* float_tmp21_i_175 = new LoadInst(ptr_arrayidx20_i_174, "tmp21.i", false, label_forbody_i13); - InsertElementInst* packed_tmp23_i9 = new InsertElementInst(packed_tmp15_i8, float_tmp21_i_175, const_int32_37, "tmp23.i9", label_forbody_i13); - std::vector ptr_arrayidx28_i_176_indices; - ptr_arrayidx28_i_176_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx28_i_176_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx28_i_176 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx28_i_176_indices.begin(), ptr_arrayidx28_i_176_indices.end(), "arrayidx28.i", label_forbody_i13); - LoadInst* float_tmp29_i_177 = new LoadInst(ptr_arrayidx28_i_176, "tmp29.i", false, label_forbody_i13); - InsertElementInst* packed_tmp31_i_178 = new InsertElementInst(packed_tmp23_i9, float_tmp29_i_177, const_int32_38, "tmp31.i", label_forbody_i13); + std::vector ptr_arrayidx20_i_175_indices; + ptr_arrayidx20_i_175_indices.push_back(int32_i_0_reg2mem_0_i3); + ptr_arrayidx20_i_175_indices.push_back(const_int32_37); + Instruction* ptr_arrayidx20_i_175 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx20_i_175_indices.begin(), ptr_arrayidx20_i_175_indices.end(), "arrayidx20.i", label_forbody_i13); + LoadInst* float_tmp21_i_176 = new LoadInst(ptr_arrayidx20_i_175, "tmp21.i", false, label_forbody_i13); + InsertElementInst* packed_tmp23_i9 = new InsertElementInst(packed_tmp15_i8, float_tmp21_i_176, const_int32_37, "tmp23.i9", label_forbody_i13); + std::vector ptr_arrayidx28_i_177_indices; + ptr_arrayidx28_i_177_indices.push_back(int32_i_0_reg2mem_0_i3); + ptr_arrayidx28_i_177_indices.push_back(const_int32_38); + Instruction* ptr_arrayidx28_i_177 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx28_i_177_indices.begin(), ptr_arrayidx28_i_177_indices.end(), "arrayidx28.i", label_forbody_i13); + LoadInst* float_tmp29_i_178 = new LoadInst(ptr_arrayidx28_i_177, "tmp29.i", false, label_forbody_i13); + InsertElementInst* packed_tmp31_i_179 = new InsertElementInst(packed_tmp23_i9, float_tmp29_i_178, const_int32_38, "tmp31.i", label_forbody_i13); std::vector ptr_arrayidx34_i10_indices; ptr_arrayidx34_i10_indices.push_back(const_int32_34); ptr_arrayidx34_i10_indices.push_back(int32_i_0_reg2mem_0_i3); Instruction* ptr_arrayidx34_i10 = new GetElementPtrInst(ptr_consts_141, ptr_arrayidx34_i10_indices.begin(), ptr_arrayidx34_i10_indices.end(), "arrayidx34.i10", label_forbody_i13); - StoreInst* void_179 = new StoreInst(packed_tmp31_i_178, ptr_arrayidx34_i10, false, label_forbody_i13); - BinaryOperator* int32_indvar_next22 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i3, const_int32_36, "indvar.next22", label_forbody_i13); - ICmpInst* int1_exitcond23 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next22, int32_num_consts_133, "exitcond23", label_forbody_i13); - new BranchInst(label_from_consts_exit_137, label_forbody_i13, int1_exitcond23, label_forbody_i13); + StoreInst* void_180 = new StoreInst(packed_tmp31_i_179, ptr_arrayidx34_i10, false, label_forbody_i13); + BinaryOperator* int32_indvar_next23 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i3, const_int32_36, "indvar.next23", label_forbody_i13); + ICmpInst* int1_exitcond24 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next23, int32_num_consts_133, "exitcond24", label_forbody_i13); + new BranchInst(label_from_consts_exit_137, label_forbody_i13, int1_exitcond24, label_forbody_i13); // Block from_consts.exit (label_from_consts_exit_137) - std::vector ptr_tmp5_indices; - ptr_tmp5_indices.push_back(const_int32_34); - ptr_tmp5_indices.push_back(const_int32_38); - Instruction* ptr_tmp5 = new GetElementPtrInst(ptr_args_144, ptr_tmp5_indices.begin(), ptr_tmp5_indices.end(), "tmp5", label_from_consts_exit_137); - std::vector ptr_arraydecay6_indices; - ptr_arraydecay6_indices.push_back(const_int32_34); - ptr_arraydecay6_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay6 = new GetElementPtrInst(ptr_consts_141, ptr_arraydecay6_indices.begin(), ptr_arraydecay6_indices.end(), "arraydecay6", label_from_consts_exit_137); - StoreInst* void_181 = new StoreInst(ptr_arraydecay6, ptr_tmp5, false, label_from_consts_exit_137); - std::vector ptr_tmp7_indices; - ptr_tmp7_indices.push_back(const_int32_34); - ptr_tmp7_indices.push_back(const_int32_37); - Instruction* ptr_tmp7 = new GetElementPtrInst(ptr_args_144, ptr_tmp7_indices.begin(), ptr_tmp7_indices.end(), "tmp7", label_from_consts_exit_137); - std::vector ptr_arraydecay8_indices; - ptr_arraydecay8_indices.push_back(const_int32_34); - ptr_arraydecay8_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay8 = new GetElementPtrInst(ptr_temps_143, ptr_arraydecay8_indices.begin(), ptr_arraydecay8_indices.end(), "arraydecay8", label_from_consts_exit_137); - StoreInst* void_182 = new StoreInst(ptr_arraydecay8, ptr_tmp7, false, label_from_consts_exit_137); - std::vector ptr_tmp10_indices; - ptr_tmp10_indices.push_back(const_int32_34); - ptr_tmp10_indices.push_back(const_int32_36); - Instruction* ptr_tmp10 = new GetElementPtrInst(ptr_args_144, ptr_tmp10_indices.begin(), ptr_tmp10_indices.end(), "tmp10", label_from_consts_exit_137); - std::vector ptr_tmp14_indices; - ptr_tmp14_indices.push_back(const_int32_34); - ptr_tmp14_indices.push_back(const_int32_34); - Instruction* ptr_tmp14 = new GetElementPtrInst(ptr_args_144, ptr_tmp14_indices.begin(), ptr_tmp14_indices.end(), "tmp14", label_from_consts_exit_137); + std::vector ptr_tmp6_182_indices; + ptr_tmp6_182_indices.push_back(const_int32_34); + ptr_tmp6_182_indices.push_back(const_int32_38); + Instruction* ptr_tmp6_182 = new GetElementPtrInst(ptr_args_144, ptr_tmp6_182_indices.begin(), ptr_tmp6_182_indices.end(), "tmp6", label_from_consts_exit_137); + std::vector ptr_arraydecay7_183_indices; + ptr_arraydecay7_183_indices.push_back(const_int32_34); + ptr_arraydecay7_183_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay7_183 = new GetElementPtrInst(ptr_consts_141, ptr_arraydecay7_183_indices.begin(), ptr_arraydecay7_183_indices.end(), "arraydecay7", label_from_consts_exit_137); + StoreInst* void_184 = new StoreInst(ptr_arraydecay7_183, ptr_tmp6_182, false, label_from_consts_exit_137); + std::vector ptr_tmp8_185_indices; + ptr_tmp8_185_indices.push_back(const_int32_34); + ptr_tmp8_185_indices.push_back(const_int32_37); + Instruction* ptr_tmp8_185 = new GetElementPtrInst(ptr_args_144, ptr_tmp8_185_indices.begin(), ptr_tmp8_185_indices.end(), "tmp8", label_from_consts_exit_137); + std::vector ptr_arraydecay9_186_indices; + ptr_arraydecay9_186_indices.push_back(const_int32_34); + ptr_arraydecay9_186_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay9_186 = new GetElementPtrInst(ptr_temps_143, ptr_arraydecay9_186_indices.begin(), ptr_arraydecay9_186_indices.end(), "arraydecay9", label_from_consts_exit_137); + StoreInst* void_187 = new StoreInst(ptr_arraydecay9_186, ptr_tmp8_185, false, label_from_consts_exit_137); + std::vector ptr_tmp11_indices; + ptr_tmp11_indices.push_back(const_int32_34); + ptr_tmp11_indices.push_back(const_int32_36); + Instruction* ptr_tmp11 = new GetElementPtrInst(ptr_args_144, ptr_tmp11_indices.begin(), ptr_tmp11_indices.end(), "tmp11", label_from_consts_exit_137); + std::vector ptr_tmp15_indices; + ptr_tmp15_indices.push_back(const_int32_34); + ptr_tmp15_indices.push_back(const_int32_34); + Instruction* ptr_tmp15 = new GetElementPtrInst(ptr_args_144, ptr_tmp15_indices.begin(), ptr_tmp15_indices.end(), "tmp15", label_from_consts_exit_137); new BranchInst(label_forbody_138, label_from_consts_exit_137); // Block forbody (label_forbody_138) - Argument* fwdref_185 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_184 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_138); - int32_i_0_reg2mem_0_184->reserveOperandSpace(2); - int32_i_0_reg2mem_0_184->addIncoming(const_int32_34, label_from_consts_exit_137); - int32_i_0_reg2mem_0_184->addIncoming(fwdref_185, label_forbody_138); - - std::vector ptr_arraydecay13_indices; - ptr_arraydecay13_indices.push_back(const_int32_34); - ptr_arraydecay13_indices.push_back(int32_i_0_reg2mem_0_184); - ptr_arraydecay13_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay13 = new GetElementPtrInst(ptr_inputs_140, ptr_arraydecay13_indices.begin(), ptr_arraydecay13_indices.end(), "arraydecay13", label_forbody_138); - StoreInst* void_186 = new StoreInst(ptr_arraydecay13, ptr_tmp10, false, label_forbody_138); - std::vector ptr_arraydecay18_indices; - ptr_arraydecay18_indices.push_back(const_int32_34); - ptr_arraydecay18_indices.push_back(int32_i_0_reg2mem_0_184); - ptr_arraydecay18_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay18 = new GetElementPtrInst(ptr_results_142, ptr_arraydecay18_indices.begin(), ptr_arraydecay18_indices.end(), "arraydecay18", label_forbody_138); - StoreInst* void_187 = new StoreInst(ptr_arraydecay18, ptr_tmp14, false, label_forbody_138); - CallInst* void_188 = new CallInst(func_execute_shader, ptr_args_144, "", label_forbody_138); - void_188->setCallingConv(CallingConv::C); - void_188->setTailCall(false); - LoadInst* ptr_tmp24 = new LoadInst(ptr_tmp14, "tmp24", false, label_forbody_138); + Argument* fwdref_189 = new Argument(IntegerType::get(32)); + PHINode* int32_tmp21_rle = new PHINode(IntegerType::get(32), "tmp21.rle", label_forbody_138); + int32_tmp21_rle->reserveOperandSpace(2); + int32_tmp21_rle->addIncoming(const_int32_34, label_from_consts_exit_137); + int32_tmp21_rle->addIncoming(fwdref_189, label_forbody_138); + + Argument* fwdref_191 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_190 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_138); + int32_i_0_reg2mem_0_190->reserveOperandSpace(2); + int32_i_0_reg2mem_0_190->addIncoming(const_int32_34, label_from_consts_exit_137); + int32_i_0_reg2mem_0_190->addIncoming(fwdref_191, label_forbody_138); + + std::vector ptr_arraydecay14_indices; + ptr_arraydecay14_indices.push_back(const_int32_34); + ptr_arraydecay14_indices.push_back(int32_i_0_reg2mem_0_190); + ptr_arraydecay14_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay14 = new GetElementPtrInst(ptr_inputs_140, ptr_arraydecay14_indices.begin(), ptr_arraydecay14_indices.end(), "arraydecay14", label_forbody_138); + StoreInst* void_192 = new StoreInst(ptr_arraydecay14, ptr_tmp11, false, label_forbody_138); + std::vector ptr_arraydecay19_indices; + ptr_arraydecay19_indices.push_back(const_int32_34); + ptr_arraydecay19_indices.push_back(int32_i_0_reg2mem_0_190); + ptr_arraydecay19_indices.push_back(const_int32_34); + Instruction* ptr_arraydecay19 = new GetElementPtrInst(ptr_results_142, ptr_arraydecay19_indices.begin(), ptr_arraydecay19_indices.end(), "arraydecay19", label_forbody_138); + StoreInst* void_193 = new StoreInst(ptr_arraydecay19, ptr_tmp15, false, label_forbody_138); + StoreInst* void_194 = new StoreInst(const_int32_34, ptr_tmp, false, label_forbody_138); + CallInst* void_195 = new CallInst(func_execute_shader, ptr_args_144, "", label_forbody_138); + void_195->setCallingConv(CallingConv::C); + void_195->setTailCall(false); + LoadInst* int32_tmp26 = new LoadInst(ptr_tmp, "tmp26", false, label_forbody_138); + BinaryOperator* int32_shl = BinaryOperator::create(Instruction::Shl, int32_tmp26, int32_i_0_reg2mem_0_190, "shl", label_forbody_138); + BinaryOperator* int32_or = BinaryOperator::create(Instruction::Or, int32_shl, int32_tmp21_rle, "or", label_forbody_138); + StoreInst* void_196 = new StoreInst(int32_or, ptr_tmp, false, label_forbody_138); + LoadInst* ptr_tmp33 = new LoadInst(ptr_tmp15, "tmp33", false, label_forbody_138); std::vector ptr_arraydecay_i_indices; - ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_190); ptr_arraydecay_i_indices.push_back(const_int32_34); ptr_arraydecay_i_indices.push_back(const_int32_34); Instruction* ptr_arraydecay_i = new GetElementPtrInst(ptr_dests_129, ptr_arraydecay_i_indices.begin(), ptr_arraydecay_i_indices.end(), "arraydecay.i", label_forbody_138); - LoadInst* packed_tmp7_i = new LoadInst(ptr_tmp24, "tmp7.i", false, label_forbody_138); + LoadInst* packed_tmp7_i = new LoadInst(ptr_tmp33, "tmp7.i", false, label_forbody_138); ExtractElementInst* float_tmp11_i = new ExtractElementInst(packed_tmp7_i, const_int32_34, "tmp11.i", label_forbody_138); - StoreInst* void_189 = new StoreInst(float_tmp11_i, ptr_arraydecay_i, false, label_forbody_138); + StoreInst* void_197 = new StoreInst(float_tmp11_i, ptr_arraydecay_i, false, label_forbody_138); std::vector ptr_arrayidx13_i_indices; - ptr_arrayidx13_i_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx13_i_indices.push_back(int32_i_0_reg2mem_0_190); ptr_arrayidx13_i_indices.push_back(const_int32_34); ptr_arrayidx13_i_indices.push_back(const_int32_36); Instruction* ptr_arrayidx13_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx13_i_indices.begin(), ptr_arrayidx13_i_indices.end(), "arrayidx13.i", label_forbody_138); ExtractElementInst* float_tmp15_i2 = new ExtractElementInst(packed_tmp7_i, const_int32_36, "tmp15.i2", label_forbody_138); - StoreInst* void_190 = new StoreInst(float_tmp15_i2, ptr_arrayidx13_i, false, label_forbody_138); + StoreInst* void_198 = new StoreInst(float_tmp15_i2, ptr_arrayidx13_i, false, label_forbody_138); std::vector ptr_arrayidx17_i_indices; - ptr_arrayidx17_i_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx17_i_indices.push_back(int32_i_0_reg2mem_0_190); ptr_arrayidx17_i_indices.push_back(const_int32_34); ptr_arrayidx17_i_indices.push_back(const_int32_37); Instruction* ptr_arrayidx17_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx17_i_indices.begin(), ptr_arrayidx17_i_indices.end(), "arrayidx17.i", label_forbody_138); ExtractElementInst* float_tmp19_i = new ExtractElementInst(packed_tmp7_i, const_int32_37, "tmp19.i", label_forbody_138); - StoreInst* void_191 = new StoreInst(float_tmp19_i, ptr_arrayidx17_i, false, label_forbody_138); + StoreInst* void_199 = new StoreInst(float_tmp19_i, ptr_arrayidx17_i, false, label_forbody_138); std::vector ptr_arrayidx21_i_indices; - ptr_arrayidx21_i_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx21_i_indices.push_back(int32_i_0_reg2mem_0_190); ptr_arrayidx21_i_indices.push_back(const_int32_34); ptr_arrayidx21_i_indices.push_back(const_int32_38); Instruction* ptr_arrayidx21_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx21_i_indices.begin(), ptr_arrayidx21_i_indices.end(), "arrayidx21.i", label_forbody_138); ExtractElementInst* float_tmp23_i = new ExtractElementInst(packed_tmp7_i, const_int32_38, "tmp23.i", label_forbody_138); - StoreInst* void_192 = new StoreInst(float_tmp23_i, ptr_arrayidx21_i, false, label_forbody_138); + StoreInst* void_200 = new StoreInst(float_tmp23_i, ptr_arrayidx21_i, false, label_forbody_138); std::vector ptr_arraydecay_i_1_indices; - ptr_arraydecay_i_1_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arraydecay_i_1_indices.push_back(int32_i_0_reg2mem_0_190); ptr_arraydecay_i_1_indices.push_back(const_int32_36); ptr_arraydecay_i_1_indices.push_back(const_int32_34); Instruction* ptr_arraydecay_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arraydecay_i_1_indices.begin(), ptr_arraydecay_i_1_indices.end(), "arraydecay.i.1", label_forbody_138); - GetElementPtrInst* ptr_arrayidx6_i_1 = new GetElementPtrInst(ptr_tmp24, const_int32_36, "arrayidx6.i.1", label_forbody_138); + GetElementPtrInst* ptr_arrayidx6_i_1 = new GetElementPtrInst(ptr_tmp33, const_int32_36, "arrayidx6.i.1", label_forbody_138); LoadInst* packed_tmp7_i_1 = new LoadInst(ptr_arrayidx6_i_1, "tmp7.i.1", false, label_forbody_138); ExtractElementInst* float_tmp11_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_34, "tmp11.i.1", label_forbody_138); - StoreInst* void_193 = new StoreInst(float_tmp11_i_1, ptr_arraydecay_i_1, false, label_forbody_138); + StoreInst* void_201 = new StoreInst(float_tmp11_i_1, ptr_arraydecay_i_1, false, label_forbody_138); std::vector ptr_arrayidx13_i_1_indices; - ptr_arrayidx13_i_1_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx13_i_1_indices.push_back(int32_i_0_reg2mem_0_190); ptr_arrayidx13_i_1_indices.push_back(const_int32_36); ptr_arrayidx13_i_1_indices.push_back(const_int32_36); Instruction* ptr_arrayidx13_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx13_i_1_indices.begin(), ptr_arrayidx13_i_1_indices.end(), "arrayidx13.i.1", label_forbody_138); ExtractElementInst* float_tmp15_i2_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_36, "tmp15.i2.1", label_forbody_138); - StoreInst* void_194 = new StoreInst(float_tmp15_i2_1, ptr_arrayidx13_i_1, false, label_forbody_138); + StoreInst* void_202 = new StoreInst(float_tmp15_i2_1, ptr_arrayidx13_i_1, false, label_forbody_138); std::vector ptr_arrayidx17_i_1_indices; - ptr_arrayidx17_i_1_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx17_i_1_indices.push_back(int32_i_0_reg2mem_0_190); ptr_arrayidx17_i_1_indices.push_back(const_int32_36); ptr_arrayidx17_i_1_indices.push_back(const_int32_37); Instruction* ptr_arrayidx17_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx17_i_1_indices.begin(), ptr_arrayidx17_i_1_indices.end(), "arrayidx17.i.1", label_forbody_138); ExtractElementInst* float_tmp19_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_37, "tmp19.i.1", label_forbody_138); - StoreInst* void_195 = new StoreInst(float_tmp19_i_1, ptr_arrayidx17_i_1, false, label_forbody_138); + StoreInst* void_203 = new StoreInst(float_tmp19_i_1, ptr_arrayidx17_i_1, false, label_forbody_138); std::vector ptr_arrayidx21_i_1_indices; - ptr_arrayidx21_i_1_indices.push_back(int32_i_0_reg2mem_0_184); + ptr_arrayidx21_i_1_indices.push_back(int32_i_0_reg2mem_0_190); ptr_arrayidx21_i_1_indices.push_back(const_int32_36); ptr_arrayidx21_i_1_indices.push_back(const_int32_38); Instruction* ptr_arrayidx21_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx21_i_1_indices.begin(), ptr_arrayidx21_i_1_indices.end(), "arrayidx21.i.1", label_forbody_138); ExtractElementInst* float_tmp23_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_38, "tmp23.i.1", label_forbody_138); - StoreInst* void_196 = new StoreInst(float_tmp23_i_1, ptr_arrayidx21_i_1, false, label_forbody_138); - BinaryOperator* int32_indvar_next20 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_184, const_int32_36, "indvar.next20", label_forbody_138); - ICmpInst* int1_exitcond21 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next20, const_int32_39, "exitcond21", label_forbody_138); - new BranchInst(label_afterfor_139, label_forbody_138, int1_exitcond21, label_forbody_138); + StoreInst* void_204 = new StoreInst(float_tmp23_i_1, ptr_arrayidx21_i_1, false, label_forbody_138); + BinaryOperator* int32_indvar_next21 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_190, const_int32_36, "indvar.next21", label_forbody_138); + ICmpInst* int1_exitcond22 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next21, const_int32_39, "exitcond22", label_forbody_138); + new BranchInst(label_afterfor_139, label_forbody_138, int1_exitcond22, label_forbody_138); // Block afterfor (label_afterfor_139) - std::vector ptr_tmp26_indices; - ptr_tmp26_indices.push_back(const_int32_34); - ptr_tmp26_indices.push_back(const_int32_39); - Instruction* ptr_tmp26 = new GetElementPtrInst(ptr_args_144, ptr_tmp26_indices.begin(), ptr_tmp26_indices.end(), "tmp26", label_afterfor_139); - LoadInst* int32_tmp27 = new LoadInst(ptr_tmp26, "tmp27", false, label_afterfor_139); - BinaryOperator* int32_neg = BinaryOperator::create(Instruction::Xor, int32_tmp27, const_int32_40, "neg", label_afterfor_139); + BinaryOperator* int32_neg = BinaryOperator::create(Instruction::Xor, int32_or, const_int32_40, "neg", label_afterfor_139); new ReturnInst(int32_neg, label_afterfor_139); // Block forbody6.i.1 (label_forbody6_i_1) - Argument* fwdref_199 = new Argument(IntegerType::get(32)); + Argument* fwdref_207 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0_i_1 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.1", label_forbody6_i_1); int32_j_0_reg2mem_0_i_1->reserveOperandSpace(2); int32_j_0_reg2mem_0_i_1->addIncoming(const_int32_34, label_forbody6_i_135); - int32_j_0_reg2mem_0_i_1->addIncoming(fwdref_199, label_forbody6_i_1); + int32_j_0_reg2mem_0_i_1->addIncoming(fwdref_207, label_forbody6_i_1); - Argument* fwdref_200 = new Argument(VectorTy_1); + Argument* fwdref_208 = new Argument(VectorTy_1); PHINode* packed_vec_0_reg2mem_0_i_1 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.1", label_forbody6_i_1); packed_vec_0_reg2mem_0_i_1->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_1->addIncoming(packed_tmp48_i_162, label_forbody6_i_135); - packed_vec_0_reg2mem_0_i_1->addIncoming(fwdref_200, label_forbody6_i_1); + packed_vec_0_reg2mem_0_i_1->addIncoming(packed_tmp48_i_163, label_forbody6_i_135); + packed_vec_0_reg2mem_0_i_1->addIncoming(fwdref_208, label_forbody6_i_1); std::vector ptr_arraydecay11_i_1_indices; ptr_arraydecay11_i_1_indices.push_back(const_int32_36); @@ -1084,23 +1095,23 @@ Module* createBaseShader() { ptr_arrayidx54_i_1_indices.push_back(const_int32_36); ptr_arrayidx54_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); Instruction* ptr_arrayidx54_i_1 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_1_indices.begin(), ptr_arrayidx54_i_1_indices.end(), "arrayidx54.i.1", label_forbody6_i_1); - StoreInst* void_201 = new StoreInst(packed_tmp48_i_1, ptr_arrayidx54_i_1, false, label_forbody6_i_1); + StoreInst* void_209 = new StoreInst(packed_tmp48_i_1, ptr_arrayidx54_i_1, false, label_forbody6_i_1); BinaryOperator* int32_inc_i_1 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_1, const_int32_36, "inc.i.1", label_forbody6_i_1); ICmpInst* int1_cmp59_i_1 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_1, int32_num_inputs_131, "cmp59.i.1", label_forbody6_i_1); new BranchInst(label_forbody6_i_1, label_forbody6_i_2, int1_cmp59_i_1, label_forbody6_i_1); // Block forbody6.i.2 (label_forbody6_i_2) - Argument* fwdref_203 = new Argument(IntegerType::get(32)); + Argument* fwdref_211 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0_i_2 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.2", label_forbody6_i_2); int32_j_0_reg2mem_0_i_2->reserveOperandSpace(2); int32_j_0_reg2mem_0_i_2->addIncoming(const_int32_34, label_forbody6_i_1); - int32_j_0_reg2mem_0_i_2->addIncoming(fwdref_203, label_forbody6_i_2); + int32_j_0_reg2mem_0_i_2->addIncoming(fwdref_211, label_forbody6_i_2); - Argument* fwdref_204 = new Argument(VectorTy_1); + Argument* fwdref_212 = new Argument(VectorTy_1); PHINode* packed_vec_0_reg2mem_0_i_2 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.2", label_forbody6_i_2); packed_vec_0_reg2mem_0_i_2->reserveOperandSpace(2); packed_vec_0_reg2mem_0_i_2->addIncoming(packed_tmp48_i_1, label_forbody6_i_1); - packed_vec_0_reg2mem_0_i_2->addIncoming(fwdref_204, label_forbody6_i_2); + packed_vec_0_reg2mem_0_i_2->addIncoming(fwdref_212, label_forbody6_i_2); std::vector ptr_arraydecay11_i_2_indices; ptr_arraydecay11_i_2_indices.push_back(const_int32_37); @@ -1135,23 +1146,23 @@ Module* createBaseShader() { ptr_arrayidx54_i_2_indices.push_back(const_int32_37); ptr_arrayidx54_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); Instruction* ptr_arrayidx54_i_2 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_2_indices.begin(), ptr_arrayidx54_i_2_indices.end(), "arrayidx54.i.2", label_forbody6_i_2); - StoreInst* void_205 = new StoreInst(packed_tmp48_i_2, ptr_arrayidx54_i_2, false, label_forbody6_i_2); + StoreInst* void_213 = new StoreInst(packed_tmp48_i_2, ptr_arrayidx54_i_2, false, label_forbody6_i_2); BinaryOperator* int32_inc_i_2 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_2, const_int32_36, "inc.i.2", label_forbody6_i_2); ICmpInst* int1_cmp59_i_2 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_2, int32_num_inputs_131, "cmp59.i.2", label_forbody6_i_2); new BranchInst(label_forbody6_i_2, label_forbody6_i_3, int1_cmp59_i_2, label_forbody6_i_2); // Block forbody6.i.3 (label_forbody6_i_3) - Argument* fwdref_207 = new Argument(IntegerType::get(32)); + Argument* fwdref_215 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0_i_3 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.3", label_forbody6_i_3); int32_j_0_reg2mem_0_i_3->reserveOperandSpace(2); int32_j_0_reg2mem_0_i_3->addIncoming(const_int32_34, label_forbody6_i_2); - int32_j_0_reg2mem_0_i_3->addIncoming(fwdref_207, label_forbody6_i_3); + int32_j_0_reg2mem_0_i_3->addIncoming(fwdref_215, label_forbody6_i_3); - Argument* fwdref_208 = new Argument(VectorTy_1); + Argument* fwdref_216 = new Argument(VectorTy_1); PHINode* packed_vec_0_reg2mem_0_i_3 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.3", label_forbody6_i_3); packed_vec_0_reg2mem_0_i_3->reserveOperandSpace(2); packed_vec_0_reg2mem_0_i_3->addIncoming(packed_tmp48_i_2, label_forbody6_i_2); - packed_vec_0_reg2mem_0_i_3->addIncoming(fwdref_208, label_forbody6_i_3); + packed_vec_0_reg2mem_0_i_3->addIncoming(fwdref_216, label_forbody6_i_3); std::vector ptr_arraydecay11_i_3_indices; ptr_arraydecay11_i_3_indices.push_back(const_int32_38); @@ -1186,23 +1197,24 @@ Module* createBaseShader() { ptr_arrayidx54_i_3_indices.push_back(const_int32_38); ptr_arrayidx54_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); Instruction* ptr_arrayidx54_i_3 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_3_indices.begin(), ptr_arrayidx54_i_3_indices.end(), "arrayidx54.i.3", label_forbody6_i_3); - StoreInst* void_209 = new StoreInst(packed_tmp48_i_3, ptr_arrayidx54_i_3, false, label_forbody6_i_3); + StoreInst* void_217 = new StoreInst(packed_tmp48_i_3, ptr_arrayidx54_i_3, false, label_forbody6_i_3); BinaryOperator* int32_inc_i_3 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_3, const_int32_36, "inc.i.3", label_forbody6_i_3); ICmpInst* int1_cmp59_i_3 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_3, int32_num_inputs_131, "cmp59.i.3", label_forbody6_i_3); new BranchInst(label_forbody6_i_3, label_from_array_exit_136, int1_cmp59_i_3, label_forbody6_i_3); // Resolve Forward References - fwdref_208->replaceAllUsesWith(packed_tmp48_i_3); delete fwdref_208; - fwdref_207->replaceAllUsesWith(int32_inc_i_3); delete fwdref_207; - fwdref_150->replaceAllUsesWith(packed_tmp48_i_162); delete fwdref_150; - fwdref_148->replaceAllUsesWith(int32_inc_i_165); delete fwdref_148; - fwdref_171->replaceAllUsesWith(packed_tmp31_i_178); delete fwdref_171; - fwdref_170->replaceAllUsesWith(int32_indvar_next22); delete fwdref_170; - fwdref_185->replaceAllUsesWith(int32_indvar_next20); delete fwdref_185; - fwdref_200->replaceAllUsesWith(packed_tmp48_i_1); delete fwdref_200; - fwdref_199->replaceAllUsesWith(int32_inc_i_1); delete fwdref_199; - fwdref_204->replaceAllUsesWith(packed_tmp48_i_2); delete fwdref_204; - fwdref_203->replaceAllUsesWith(int32_inc_i_2); delete fwdref_203; + fwdref_216->replaceAllUsesWith(packed_tmp48_i_3); delete fwdref_216; + fwdref_215->replaceAllUsesWith(int32_inc_i_3); delete fwdref_215; + fwdref_151->replaceAllUsesWith(packed_tmp48_i_163); delete fwdref_151; + fwdref_149->replaceAllUsesWith(int32_inc_i_166); delete fwdref_149; + fwdref_172->replaceAllUsesWith(packed_tmp31_i_179); delete fwdref_172; + fwdref_171->replaceAllUsesWith(int32_indvar_next23); delete fwdref_171; + fwdref_189->replaceAllUsesWith(int32_or); delete fwdref_189; + fwdref_191->replaceAllUsesWith(int32_indvar_next21); delete fwdref_191; + fwdref_208->replaceAllUsesWith(packed_tmp48_i_1); delete fwdref_208; + fwdref_207->replaceAllUsesWith(int32_inc_i_1); delete fwdref_207; + fwdref_212->replaceAllUsesWith(packed_tmp48_i_2); delete fwdref_212; + fwdref_211->replaceAllUsesWith(int32_inc_i_2); delete fwdref_211; } diff --git a/src/mesa/pipe/llvm/llvm_builtins.c b/src/mesa/pipe/llvm/llvm_builtins.c index 517aa2e84b..4f98d754ba 100644 --- a/src/mesa/pipe/llvm/llvm_builtins.c +++ b/src/mesa/pipe/llvm/llvm_builtins.c @@ -32,7 +32,6 @@ */ typedef __attribute__(( ocu_vector_type(4) )) float float4; - extern float powf(float a, float b); inline float approx(float a, float b) @@ -106,3 +105,11 @@ inline float4 vsin(float4 val) result.w = res; return result; } + +inline int kilp(float4 val) +{ + if (val.x < 0 || val.y < 0 || val.z < 0 || val.w < 0) + return 1; + else + return 0; +} diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c index 6bdb311c2b..03f7ac8f14 100644 --- a/src/mesa/pipe/llvm/llvm_entry.c +++ b/src/mesa/pipe/llvm/llvm_entry.c @@ -239,6 +239,8 @@ int run_fragment_shader(float x, float y, float4 results[4][16]; float4 temps[128];//MAX_PROGRAM_TEMPS struct ShaderInput args; + int mask = 0; + args.kilmask = 0; from_array(inputs, ainputs, 4, num_inputs); from_consts(consts, aconsts, num_consts); @@ -248,7 +250,11 @@ int run_fragment_shader(float x, float y, for (int i = 0; i < 4; ++i) { args.inputs = inputs[i]; args.dests = results[i]; + mask = args.kilmask; + args.kilmask = 0; execute_shader(&args); + args.kilmask = mask | (args.kilmask << i); + to_array(dests[i], args.dests, 2); } return ~args.kilmask; diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/mesa/pipe/llvm/storage.cpp index 71045fa37f..c33b9bf45d 100644 --- a/src/mesa/pipe/llvm/storage.cpp +++ b/src/mesa/pipe/llvm/storage.cpp @@ -343,6 +343,20 @@ llvm::Value * Storage::element(Args arg, int idx, llvm::Value *indIdx ) return elemIdx(val, idx, indIdx); } +void Storage::setKilElement(llvm::Value *val) +{ + std::vector indices; + indices.push_back(constantInt(0)); + indices.push_back(constantInt(static_cast(KilArg))); + GetElementPtrInst *elem = new GetElementPtrInst(m_INPUT, + indices.begin(), + indices.end(), + name("kil_ptr"), + m_block); + StoreInst *st = new StoreInst(val, elem, false, m_block); + st->setAlignment(8); +} + #endif //MESA_LLVM diff --git a/src/mesa/pipe/llvm/storage.h b/src/mesa/pipe/llvm/storage.h index 7f1a8bf103..8574f7554e 100644 --- a/src/mesa/pipe/llvm/storage.h +++ b/src/mesa/pipe/llvm/storage.h @@ -71,6 +71,8 @@ public: llvm::Value *addrElement(int idx) const; void setAddrElement(int idx, llvm::Value *val, int mask); + void setKilElement(llvm::Value *val); + llvm::Value *shuffleVector(llvm::Value *vec, int shuffle); llvm::Value *extractIndex(llvm::Value *vec); diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 9307ed233d..5ea07f95a4 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -202,7 +202,7 @@ shade_quad_llvm(struct quad_stage *qs, } #endif - /*quad->mask &=*/ + quad->mask &= gallivm_fragment_shader_exec(llvm, fx, fy, dests, inputs, softpipe->mapped_constants[PIPE_SHADER_FRAGMENT], qss->samplers); -- cgit v1.2.3 From 6dc4e6ae15676cf4acdebb9c798bfa4083ad1e14 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 7 Nov 2007 13:26:45 -0500 Subject: Redo the way we pass arguments to the llvm. simply pass aligned arrays, they should cast to vectors without any problems. also remove unnecessary memset --- src/mesa/pipe/draw/draw_vertex_shader_llvm.c | 7 +- src/mesa/pipe/llvm/llvm_base_shader.cpp | 1320 +++++++++----------------- src/mesa/pipe/llvm/llvm_entry.c | 20 +- src/mesa/pipe/p_compiler.h | 2 + src/mesa/pipe/softpipe/sp_quad_fs.c | 5 +- 5 files changed, 458 insertions(+), 896 deletions(-) (limited to 'src/mesa/pipe/llvm/llvm_base_shader.cpp') diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c index 10fd33fbde..34a4d27684 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c +++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c @@ -115,13 +115,12 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) unsigned i; struct vertex_header *dests[VS_QUEUE_LENGTH]; - float inputs[VS_QUEUE_LENGTH][PIPE_MAX_SHADER_INPUTS][4]; - float outputs[VS_QUEUE_LENGTH][PIPE_MAX_SHADER_INPUTS][4]; + float inputs[VS_QUEUE_LENGTH][PIPE_MAX_SHADER_INPUTS][4] ALIGN16_ATTRIB; + float outputs[VS_QUEUE_LENGTH][PIPE_MAX_SHADER_INPUTS][4] ALIGN16_ATTRIB; float (*consts)[4] = (float (*)[4]) draw->user.constants; struct gallivm_prog *prog = draw->vertex_shader->llvm_prog; const float *scale = draw->viewport.scale; const float *trans = draw->viewport.translate; - /* fetch the inputs */ for (i = 0; i < draw->vs.queue_nr; ++i) { unsigned elt = draw->vs.queue[i].elt; @@ -135,6 +134,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) draw->vertex_shader->state->num_inputs, draw->vertex_info.num_attribs - 2); + /* store machine results */ for (int i = 0; i < draw->vs.queue_nr; ++i) { unsigned slot; @@ -158,7 +158,6 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) vOut->clipmask = compute_clipmask(vOut->clip, draw->plane, draw->nr_planes); vOut->edgeflag = 1; - /* divide by w */ w = 1.0f / w; x *= w; diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp index 82ad6cfa26..85fa389d79 100644 --- a/src/mesa/pipe/llvm/llvm_base_shader.cpp +++ b/src/mesa/pipe/llvm/llvm_base_shader.cpp @@ -118,8 +118,8 @@ Module* createBaseShader() { /*ParamAttrs=*/FuncTy_18_PAL); std::vectorFuncTy_19_args; - FuncTy_19_args.push_back(PointerTy_15); - FuncTy_19_args.push_back(PointerTy_15); + FuncTy_19_args.push_back(PointerTy_13); + FuncTy_19_args.push_back(PointerTy_13); FuncTy_19_args.push_back(PointerTy_8); FuncTy_19_args.push_back(IntegerType::get(32)); FuncTy_19_args.push_back(IntegerType::get(32)); @@ -132,55 +132,47 @@ Module* createBaseShader() { /*isVarArg=*/false, /*ParamAttrs=*/FuncTy_19_PAL); - ArrayType* ArrayTy_21 = ArrayType::get(ArrayTy_14, 2048); + ArrayType* ArrayTy_21 = ArrayType::get(VectorTy_1, 32); PointerType* PointerTy_20 = PointerType::get(ArrayTy_21); - ArrayType* ArrayTy_23 = ArrayType::get(VectorTy_1, 32); + ArrayType* ArrayTy_23 = ArrayType::get(VectorTy_1, 128); PointerType* PointerTy_22 = PointerType::get(ArrayTy_23); - ArrayType* ArrayTy_25 = ArrayType::get(VectorTy_1, 128); + PointerType* PointerTy_24 = PointerType::get(StructTy_struct_ShaderInput); - PointerType* PointerTy_24 = PointerType::get(ArrayTy_25); + PointerType* PointerTy_25 = PointerType::get(PointerTy_0); - PointerType* PointerTy_26 = PointerType::get(StructTy_struct_ShaderInput); - - PointerType* PointerTy_27 = PointerType::get(PointerTy_0); - - std::vectorFuncTy_29_args; - FuncTy_29_args.push_back(PointerTy_26); - ParamAttrsList *FuncTy_29_PAL = 0; - FunctionType* FuncTy_29 = FunctionType::get( + std::vectorFuncTy_27_args; + FuncTy_27_args.push_back(PointerTy_24); + ParamAttrsList *FuncTy_27_PAL = 0; + FunctionType* FuncTy_27 = FunctionType::get( /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_29_args, + /*Params=*/FuncTy_27_args, /*isVarArg=*/false, - /*ParamAttrs=*/FuncTy_29_PAL); - - PointerType* PointerTy_28 = PointerType::get(FuncTy_29); - - std::vectorFuncTy_30_args; - FuncTy_30_args.push_back(Type::FloatTy); - FuncTy_30_args.push_back(Type::FloatTy); - FuncTy_30_args.push_back(PointerTy_15); - FuncTy_30_args.push_back(PointerTy_15); - FuncTy_30_args.push_back(IntegerType::get(32)); - FuncTy_30_args.push_back(PointerTy_8); - FuncTy_30_args.push_back(IntegerType::get(32)); - FuncTy_30_args.push_back(PointerTy_6); - PointerType* PointerTy_31 = PointerType::get(IntegerType::get(32)); - - FuncTy_30_args.push_back(PointerTy_31); - ParamAttrsList *FuncTy_30_PAL = 0; - FunctionType* FuncTy_30 = FunctionType::get( + /*ParamAttrs=*/FuncTy_27_PAL); + + PointerType* PointerTy_26 = PointerType::get(FuncTy_27); + + std::vectorFuncTy_28_args; + FuncTy_28_args.push_back(Type::FloatTy); + FuncTy_28_args.push_back(Type::FloatTy); + FuncTy_28_args.push_back(PointerTy_13); + FuncTy_28_args.push_back(PointerTy_13); + FuncTy_28_args.push_back(IntegerType::get(32)); + FuncTy_28_args.push_back(PointerTy_8); + FuncTy_28_args.push_back(IntegerType::get(32)); + FuncTy_28_args.push_back(PointerTy_6); + PointerType* PointerTy_29 = PointerType::get(IntegerType::get(32)); + + FuncTy_28_args.push_back(PointerTy_29); + ParamAttrsList *FuncTy_28_PAL = 0; + FunctionType* FuncTy_28 = FunctionType::get( /*Result=*/IntegerType::get(32), - /*Params=*/FuncTy_30_args, + /*Params=*/FuncTy_28_args, /*isVarArg=*/false, - /*ParamAttrs=*/FuncTy_30_PAL); - - ArrayType* ArrayTy_33 = ArrayType::get(ArrayTy_14, 4); - - PointerType* PointerTy_32 = PointerType::get(ArrayTy_33); + /*ParamAttrs=*/FuncTy_28_PAL); // Function Declarations @@ -210,13 +202,13 @@ Module* createBaseShader() { func_run_vertex_shader->setCallingConv(CallingConv::C); Function* func_execute_shader = new Function( - /*Type=*/FuncTy_29, + /*Type=*/FuncTy_27, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"execute_shader", mod); // (external, no body) func_execute_shader->setCallingConv(CallingConv::C); Function* func_run_fragment_shader = new Function( - /*Type=*/FuncTy_30, + /*Type=*/FuncTy_28, /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"run_fragment_shader", mod); func_run_fragment_shader->setCallingConv(CallingConv::C); @@ -225,13 +217,13 @@ Module* createBaseShader() { // Constant Definitions - Constant* const_int32_34 = Constant::getNullValue(IntegerType::get(32)); - UndefValue* const_packed_35 = UndefValue::get(VectorTy_1); - ConstantInt* const_int32_36 = ConstantInt::get(APInt(32, "1", 10)); - ConstantInt* const_int32_37 = ConstantInt::get(APInt(32, "2", 10)); - ConstantInt* const_int32_38 = ConstantInt::get(APInt(32, "3", 10)); - ConstantInt* const_int32_39 = ConstantInt::get(APInt(32, "4", 10)); - ConstantInt* const_int32_40 = ConstantInt::get(APInt(32, "-1", 10)); + Constant* const_int32_30 = Constant::getNullValue(IntegerType::get(32)); + UndefValue* const_packed_31 = UndefValue::get(VectorTy_1); + ConstantInt* const_int32_32 = ConstantInt::get(APInt(32, "1", 10)); + ConstantInt* const_int32_33 = ConstantInt::get(APInt(32, "2", 10)); + ConstantInt* const_int32_34 = ConstantInt::get(APInt(32, "3", 10)); + ConstantInt* const_int32_35 = ConstantInt::get(APInt(32, "4", 10)); + ConstantInt* const_int32_36 = ConstantInt::get(APInt(32, "-1", 10)); // Global Variable Definitions @@ -255,73 +247,73 @@ Module* createBaseShader() { BasicBlock* label_afterfor60 = new BasicBlock("afterfor60",func_from_array,0); // Block entry (label_entry) - ICmpInst* int1_cmp = new ICmpInst(ICmpInst::ICMP_SGT, int32_count, const_int32_34, "cmp", label_entry); - ICmpInst* int1_cmp5 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs, const_int32_34, "cmp5", label_entry); + ICmpInst* int1_cmp = new ICmpInst(ICmpInst::ICMP_SGT, int32_count, const_int32_30, "cmp", label_entry); + ICmpInst* int1_cmp5 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs, const_int32_30, "cmp5", label_entry); BinaryOperator* int1_bothcond = BinaryOperator::create(Instruction::And, int1_cmp, int1_cmp5, "bothcond", label_entry); new BranchInst(label_forbody6, label_afterfor60, int1_bothcond, label_entry); // Block forbody6 (label_forbody6) - Argument* fwdref_42 = new Argument(IntegerType::get(32)); - Argument* fwdref_43 = new Argument(IntegerType::get(32)); + Argument* fwdref_38 = new Argument(IntegerType::get(32)); + Argument* fwdref_39 = new Argument(IntegerType::get(32)); PHINode* int32_i_0_reg2mem_0 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody6); int32_i_0_reg2mem_0->reserveOperandSpace(3); - int32_i_0_reg2mem_0->addIncoming(const_int32_34, label_entry); - int32_i_0_reg2mem_0->addIncoming(fwdref_42, label_forinc57); - int32_i_0_reg2mem_0->addIncoming(fwdref_43, label_forbody6); + int32_i_0_reg2mem_0->addIncoming(const_int32_30, label_entry); + int32_i_0_reg2mem_0->addIncoming(fwdref_38, label_forinc57); + int32_i_0_reg2mem_0->addIncoming(fwdref_39, label_forbody6); - Argument* fwdref_44 = new Argument(IntegerType::get(32)); + Argument* fwdref_40 = new Argument(IntegerType::get(32)); PHINode* int32_j_0_reg2mem_0 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0", label_forbody6); int32_j_0_reg2mem_0->reserveOperandSpace(3); - int32_j_0_reg2mem_0->addIncoming(fwdref_44, label_forbody6); - int32_j_0_reg2mem_0->addIncoming(const_int32_34, label_forinc57); - int32_j_0_reg2mem_0->addIncoming(const_int32_34, label_entry); + int32_j_0_reg2mem_0->addIncoming(fwdref_40, label_forbody6); + int32_j_0_reg2mem_0->addIncoming(const_int32_30, label_forinc57); + int32_j_0_reg2mem_0->addIncoming(const_int32_30, label_entry); - Argument* fwdref_45 = new Argument(VectorTy_1); + Argument* fwdref_41 = new Argument(VectorTy_1); PHINode* packed_vec_0_reg2mem_0 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody6); packed_vec_0_reg2mem_0->reserveOperandSpace(3); - packed_vec_0_reg2mem_0->addIncoming(fwdref_45, label_forbody6); - packed_vec_0_reg2mem_0->addIncoming(const_packed_35, label_entry); - packed_vec_0_reg2mem_0->addIncoming(fwdref_45, label_forinc57); + packed_vec_0_reg2mem_0->addIncoming(fwdref_41, label_forbody6); + packed_vec_0_reg2mem_0->addIncoming(const_packed_31, label_entry); + packed_vec_0_reg2mem_0->addIncoming(fwdref_41, label_forinc57); std::vector ptr_arraydecay11_indices; ptr_arraydecay11_indices.push_back(int32_i_0_reg2mem_0); ptr_arraydecay11_indices.push_back(int32_j_0_reg2mem_0); - ptr_arraydecay11_indices.push_back(const_int32_34); + ptr_arraydecay11_indices.push_back(const_int32_30); Instruction* ptr_arraydecay11 = new GetElementPtrInst(ptr_ainputs, ptr_arraydecay11_indices.begin(), ptr_arraydecay11_indices.end(), "arraydecay11", label_forbody6); LoadInst* float_tmp13 = new LoadInst(ptr_arraydecay11, "tmp13", false, label_forbody6); - InsertElementInst* packed_tmp15 = new InsertElementInst(packed_vec_0_reg2mem_0, float_tmp13, const_int32_34, "tmp15", label_forbody6); + InsertElementInst* packed_tmp15 = new InsertElementInst(packed_vec_0_reg2mem_0, float_tmp13, const_int32_30, "tmp15", label_forbody6); std::vector ptr_arrayidx23_indices; ptr_arrayidx23_indices.push_back(int32_i_0_reg2mem_0); ptr_arrayidx23_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx23_indices.push_back(const_int32_36); + ptr_arrayidx23_indices.push_back(const_int32_32); Instruction* ptr_arrayidx23 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx23_indices.begin(), ptr_arrayidx23_indices.end(), "arrayidx23", label_forbody6); LoadInst* float_tmp24 = new LoadInst(ptr_arrayidx23, "tmp24", false, label_forbody6); - InsertElementInst* packed_tmp26 = new InsertElementInst(packed_tmp15, float_tmp24, const_int32_36, "tmp26", label_forbody6); + InsertElementInst* packed_tmp26 = new InsertElementInst(packed_tmp15, float_tmp24, const_int32_32, "tmp26", label_forbody6); std::vector ptr_arrayidx34_indices; ptr_arrayidx34_indices.push_back(int32_i_0_reg2mem_0); ptr_arrayidx34_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx34_indices.push_back(const_int32_37); + ptr_arrayidx34_indices.push_back(const_int32_33); Instruction* ptr_arrayidx34 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx34_indices.begin(), ptr_arrayidx34_indices.end(), "arrayidx34", label_forbody6); LoadInst* float_tmp35 = new LoadInst(ptr_arrayidx34, "tmp35", false, label_forbody6); - InsertElementInst* packed_tmp37 = new InsertElementInst(packed_tmp26, float_tmp35, const_int32_37, "tmp37", label_forbody6); + InsertElementInst* packed_tmp37 = new InsertElementInst(packed_tmp26, float_tmp35, const_int32_33, "tmp37", label_forbody6); std::vector ptr_arrayidx45_indices; ptr_arrayidx45_indices.push_back(int32_i_0_reg2mem_0); ptr_arrayidx45_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx45_indices.push_back(const_int32_38); + ptr_arrayidx45_indices.push_back(const_int32_34); Instruction* ptr_arrayidx45 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx45_indices.begin(), ptr_arrayidx45_indices.end(), "arrayidx45", label_forbody6); LoadInst* float_tmp46 = new LoadInst(ptr_arrayidx45, "tmp46", false, label_forbody6); - InsertElementInst* packed_tmp48 = new InsertElementInst(packed_tmp37, float_tmp46, const_int32_38, "tmp48", label_forbody6); + InsertElementInst* packed_tmp48 = new InsertElementInst(packed_tmp37, float_tmp46, const_int32_34, "tmp48", label_forbody6); std::vector ptr_arrayidx54_indices; ptr_arrayidx54_indices.push_back(int32_i_0_reg2mem_0); ptr_arrayidx54_indices.push_back(int32_j_0_reg2mem_0); Instruction* ptr_arrayidx54 = new GetElementPtrInst(ptr_res, ptr_arrayidx54_indices.begin(), ptr_arrayidx54_indices.end(), "arrayidx54", label_forbody6); - StoreInst* void_46 = new StoreInst(packed_tmp48, ptr_arrayidx54, false, label_forbody6); - BinaryOperator* int32_inc = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0, const_int32_36, "inc", label_forbody6); + StoreInst* void_42 = new StoreInst(packed_tmp48, ptr_arrayidx54, false, label_forbody6); + BinaryOperator* int32_inc = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0, const_int32_32, "inc", label_forbody6); ICmpInst* int1_cmp59 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc, int32_num_attribs, "cmp59", label_forbody6); new BranchInst(label_forbody6, label_forinc57, int1_cmp59, label_forbody6); // Block forinc57 (label_forinc57) - BinaryOperator* int32_inc59 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0, const_int32_36, "inc59", label_forinc57); + BinaryOperator* int32_inc59 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0, const_int32_32, "inc59", label_forinc57); ICmpInst* int1_cmp17 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc59, int32_count, "cmp17", label_forinc57); new BranchInst(label_forbody6, label_afterfor60, int1_cmp17, label_forinc57); @@ -329,80 +321,80 @@ Module* createBaseShader() { new ReturnInst(label_afterfor60); // Resolve Forward References - fwdref_43->replaceAllUsesWith(int32_i_0_reg2mem_0); delete fwdref_43; - fwdref_45->replaceAllUsesWith(packed_tmp48); delete fwdref_45; - fwdref_44->replaceAllUsesWith(int32_inc); delete fwdref_44; - fwdref_42->replaceAllUsesWith(int32_inc59); delete fwdref_42; + fwdref_39->replaceAllUsesWith(int32_i_0_reg2mem_0); delete fwdref_39; + fwdref_41->replaceAllUsesWith(packed_tmp48); delete fwdref_41; + fwdref_40->replaceAllUsesWith(int32_inc); delete fwdref_40; + fwdref_38->replaceAllUsesWith(int32_inc59); delete fwdref_38; } // Function: from_consts (func_from_consts) { Function::arg_iterator args = func_from_consts->arg_begin(); - Value* ptr_res_50 = args++; - ptr_res_50->setName("res"); - Value* ptr_ainputs_51 = args++; - ptr_ainputs_51->setName("ainputs"); - Value* int32_count_52 = args++; - int32_count_52->setName("count"); - - BasicBlock* label_entry_53 = new BasicBlock("entry",func_from_consts,0); + Value* ptr_res_46 = args++; + ptr_res_46->setName("res"); + Value* ptr_ainputs_47 = args++; + ptr_ainputs_47->setName("ainputs"); + Value* int32_count_48 = args++; + int32_count_48->setName("count"); + + BasicBlock* label_entry_49 = new BasicBlock("entry",func_from_consts,0); BasicBlock* label_forbody = new BasicBlock("forbody",func_from_consts,0); BasicBlock* label_afterfor = new BasicBlock("afterfor",func_from_consts,0); - // Block entry (label_entry_53) - ICmpInst* int1_cmp_54 = new ICmpInst(ICmpInst::ICMP_SGT, int32_count_52, const_int32_34, "cmp", label_entry_53); - new BranchInst(label_forbody, label_afterfor, int1_cmp_54, label_entry_53); + // Block entry (label_entry_49) + ICmpInst* int1_cmp_50 = new ICmpInst(ICmpInst::ICMP_SGT, int32_count_48, const_int32_30, "cmp", label_entry_49); + new BranchInst(label_forbody, label_afterfor, int1_cmp_50, label_entry_49); // Block forbody (label_forbody) - Argument* fwdref_57 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_56 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody); - int32_i_0_reg2mem_0_56->reserveOperandSpace(2); - int32_i_0_reg2mem_0_56->addIncoming(const_int32_34, label_entry_53); - int32_i_0_reg2mem_0_56->addIncoming(fwdref_57, label_forbody); - - Argument* fwdref_59 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_58 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody); - packed_vec_0_reg2mem_0_58->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_58->addIncoming(const_packed_35, label_entry_53); - packed_vec_0_reg2mem_0_58->addIncoming(fwdref_59, label_forbody); + Argument* fwdref_53 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_52 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody); + int32_i_0_reg2mem_0_52->reserveOperandSpace(2); + int32_i_0_reg2mem_0_52->addIncoming(const_int32_30, label_entry_49); + int32_i_0_reg2mem_0_52->addIncoming(fwdref_53, label_forbody); + + Argument* fwdref_55 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_54 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody); + packed_vec_0_reg2mem_0_54->reserveOperandSpace(2); + packed_vec_0_reg2mem_0_54->addIncoming(const_packed_31, label_entry_49); + packed_vec_0_reg2mem_0_54->addIncoming(fwdref_55, label_forbody); std::vector ptr_arraydecay_indices; - ptr_arraydecay_indices.push_back(int32_i_0_reg2mem_0_56); - ptr_arraydecay_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay = new GetElementPtrInst(ptr_ainputs_51, ptr_arraydecay_indices.begin(), ptr_arraydecay_indices.end(), "arraydecay", label_forbody); + ptr_arraydecay_indices.push_back(int32_i_0_reg2mem_0_52); + ptr_arraydecay_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay = new GetElementPtrInst(ptr_ainputs_47, ptr_arraydecay_indices.begin(), ptr_arraydecay_indices.end(), "arraydecay", label_forbody); LoadInst* float_tmp5 = new LoadInst(ptr_arraydecay, "tmp5", false, label_forbody); - InsertElementInst* packed_tmp7 = new InsertElementInst(packed_vec_0_reg2mem_0_58, float_tmp5, const_int32_34, "tmp7", label_forbody); + InsertElementInst* packed_tmp7 = new InsertElementInst(packed_vec_0_reg2mem_0_54, float_tmp5, const_int32_30, "tmp7", label_forbody); std::vector ptr_arrayidx12_indices; - ptr_arrayidx12_indices.push_back(int32_i_0_reg2mem_0_56); - ptr_arrayidx12_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx12 = new GetElementPtrInst(ptr_ainputs_51, ptr_arrayidx12_indices.begin(), ptr_arrayidx12_indices.end(), "arrayidx12", label_forbody); - LoadInst* float_tmp13_60 = new LoadInst(ptr_arrayidx12, "tmp13", false, label_forbody); - InsertElementInst* packed_tmp15_61 = new InsertElementInst(packed_tmp7, float_tmp13_60, const_int32_36, "tmp15", label_forbody); + ptr_arrayidx12_indices.push_back(int32_i_0_reg2mem_0_52); + ptr_arrayidx12_indices.push_back(const_int32_32); + Instruction* ptr_arrayidx12 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx12_indices.begin(), ptr_arrayidx12_indices.end(), "arrayidx12", label_forbody); + LoadInst* float_tmp13_56 = new LoadInst(ptr_arrayidx12, "tmp13", false, label_forbody); + InsertElementInst* packed_tmp15_57 = new InsertElementInst(packed_tmp7, float_tmp13_56, const_int32_32, "tmp15", label_forbody); std::vector ptr_arrayidx20_indices; - ptr_arrayidx20_indices.push_back(int32_i_0_reg2mem_0_56); - ptr_arrayidx20_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx20 = new GetElementPtrInst(ptr_ainputs_51, ptr_arrayidx20_indices.begin(), ptr_arrayidx20_indices.end(), "arrayidx20", label_forbody); + ptr_arrayidx20_indices.push_back(int32_i_0_reg2mem_0_52); + ptr_arrayidx20_indices.push_back(const_int32_33); + Instruction* ptr_arrayidx20 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx20_indices.begin(), ptr_arrayidx20_indices.end(), "arrayidx20", label_forbody); LoadInst* float_tmp21 = new LoadInst(ptr_arrayidx20, "tmp21", false, label_forbody); - InsertElementInst* packed_tmp23 = new InsertElementInst(packed_tmp15_61, float_tmp21, const_int32_37, "tmp23", label_forbody); + InsertElementInst* packed_tmp23 = new InsertElementInst(packed_tmp15_57, float_tmp21, const_int32_33, "tmp23", label_forbody); std::vector ptr_arrayidx28_indices; - ptr_arrayidx28_indices.push_back(int32_i_0_reg2mem_0_56); - ptr_arrayidx28_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx28 = new GetElementPtrInst(ptr_ainputs_51, ptr_arrayidx28_indices.begin(), ptr_arrayidx28_indices.end(), "arrayidx28", label_forbody); + ptr_arrayidx28_indices.push_back(int32_i_0_reg2mem_0_52); + ptr_arrayidx28_indices.push_back(const_int32_34); + Instruction* ptr_arrayidx28 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx28_indices.begin(), ptr_arrayidx28_indices.end(), "arrayidx28", label_forbody); LoadInst* float_tmp29 = new LoadInst(ptr_arrayidx28, "tmp29", false, label_forbody); - InsertElementInst* packed_tmp31 = new InsertElementInst(packed_tmp23, float_tmp29, const_int32_38, "tmp31", label_forbody); - GetElementPtrInst* ptr_arrayidx34_62 = new GetElementPtrInst(ptr_res_50, int32_i_0_reg2mem_0_56, "arrayidx34", label_forbody); - StoreInst* void_63 = new StoreInst(packed_tmp31, ptr_arrayidx34_62, false, label_forbody); - BinaryOperator* int32_indvar_next = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_56, const_int32_36, "indvar.next", label_forbody); - ICmpInst* int1_exitcond = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next, int32_count_52, "exitcond", label_forbody); + InsertElementInst* packed_tmp31 = new InsertElementInst(packed_tmp23, float_tmp29, const_int32_34, "tmp31", label_forbody); + GetElementPtrInst* ptr_arrayidx34_58 = new GetElementPtrInst(ptr_res_46, int32_i_0_reg2mem_0_52, "arrayidx34", label_forbody); + StoreInst* void_59 = new StoreInst(packed_tmp31, ptr_arrayidx34_58, false, label_forbody); + BinaryOperator* int32_indvar_next = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_52, const_int32_32, "indvar.next", label_forbody); + ICmpInst* int1_exitcond = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next, int32_count_48, "exitcond", label_forbody); new BranchInst(label_afterfor, label_forbody, int1_exitcond, label_forbody); // Block afterfor (label_afterfor) new ReturnInst(label_afterfor); // Resolve Forward References - fwdref_59->replaceAllUsesWith(packed_tmp31); delete fwdref_59; - fwdref_57->replaceAllUsesWith(int32_indvar_next); delete fwdref_57; + fwdref_55->replaceAllUsesWith(packed_tmp31); delete fwdref_55; + fwdref_53->replaceAllUsesWith(int32_indvar_next); delete fwdref_53; } @@ -413,363 +405,204 @@ Module* createBaseShader() { ptr_dests->setName("dests"); Value* ptr_in = args++; ptr_in->setName("in"); - Value* int32_num_attribs_66 = args++; - int32_num_attribs_66->setName("num_attribs"); - - BasicBlock* label_entry_67 = new BasicBlock("entry",func_to_array,0); - BasicBlock* label_forbody_68 = new BasicBlock("forbody",func_to_array,0); - BasicBlock* label_afterfor_69 = new BasicBlock("afterfor",func_to_array,0); - - // Block entry (label_entry_67) - ICmpInst* int1_cmp_70 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_66, const_int32_34, "cmp", label_entry_67); - new BranchInst(label_forbody_68, label_afterfor_69, int1_cmp_70, label_entry_67); - - // Block forbody (label_forbody_68) - Argument* fwdref_73 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_72 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_68); - int32_i_0_reg2mem_0_72->reserveOperandSpace(2); - int32_i_0_reg2mem_0_72->addIncoming(const_int32_34, label_entry_67); - int32_i_0_reg2mem_0_72->addIncoming(fwdref_73, label_forbody_68); - - std::vector ptr_arraydecay_74_indices; - ptr_arraydecay_74_indices.push_back(int32_i_0_reg2mem_0_72); - ptr_arraydecay_74_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay_74 = new GetElementPtrInst(ptr_dests, ptr_arraydecay_74_indices.begin(), ptr_arraydecay_74_indices.end(), "arraydecay", label_forbody_68); - GetElementPtrInst* ptr_arrayidx6 = new GetElementPtrInst(ptr_in, int32_i_0_reg2mem_0_72, "arrayidx6", label_forbody_68); - LoadInst* packed_tmp7_75 = new LoadInst(ptr_arrayidx6, "tmp7", false, label_forbody_68); - ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp7_75, const_int32_34, "tmp11", label_forbody_68); - StoreInst* void_76 = new StoreInst(float_tmp11, ptr_arraydecay_74, false, label_forbody_68); + Value* int32_num_attribs_62 = args++; + int32_num_attribs_62->setName("num_attribs"); + + BasicBlock* label_entry_63 = new BasicBlock("entry",func_to_array,0); + BasicBlock* label_forbody_64 = new BasicBlock("forbody",func_to_array,0); + BasicBlock* label_afterfor_65 = new BasicBlock("afterfor",func_to_array,0); + + // Block entry (label_entry_63) + ICmpInst* int1_cmp_66 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_62, const_int32_30, "cmp", label_entry_63); + new BranchInst(label_forbody_64, label_afterfor_65, int1_cmp_66, label_entry_63); + + // Block forbody (label_forbody_64) + Argument* fwdref_69 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_68 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_64); + int32_i_0_reg2mem_0_68->reserveOperandSpace(2); + int32_i_0_reg2mem_0_68->addIncoming(const_int32_30, label_entry_63); + int32_i_0_reg2mem_0_68->addIncoming(fwdref_69, label_forbody_64); + + std::vector ptr_arraydecay_70_indices; + ptr_arraydecay_70_indices.push_back(int32_i_0_reg2mem_0_68); + ptr_arraydecay_70_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay_70 = new GetElementPtrInst(ptr_dests, ptr_arraydecay_70_indices.begin(), ptr_arraydecay_70_indices.end(), "arraydecay", label_forbody_64); + GetElementPtrInst* ptr_arrayidx6 = new GetElementPtrInst(ptr_in, int32_i_0_reg2mem_0_68, "arrayidx6", label_forbody_64); + LoadInst* packed_tmp7_71 = new LoadInst(ptr_arrayidx6, "tmp7", false, label_forbody_64); + ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp7_71, const_int32_30, "tmp11", label_forbody_64); + StoreInst* void_72 = new StoreInst(float_tmp11, ptr_arraydecay_70, false, label_forbody_64); std::vector ptr_arrayidx13_indices; - ptr_arrayidx13_indices.push_back(int32_i_0_reg2mem_0_72); - ptr_arrayidx13_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx13 = new GetElementPtrInst(ptr_dests, ptr_arrayidx13_indices.begin(), ptr_arrayidx13_indices.end(), "arrayidx13", label_forbody_68); - ExtractElementInst* float_tmp15 = new ExtractElementInst(packed_tmp7_75, const_int32_36, "tmp15", label_forbody_68); - StoreInst* void_77 = new StoreInst(float_tmp15, ptr_arrayidx13, false, label_forbody_68); + ptr_arrayidx13_indices.push_back(int32_i_0_reg2mem_0_68); + ptr_arrayidx13_indices.push_back(const_int32_32); + Instruction* ptr_arrayidx13 = new GetElementPtrInst(ptr_dests, ptr_arrayidx13_indices.begin(), ptr_arrayidx13_indices.end(), "arrayidx13", label_forbody_64); + ExtractElementInst* float_tmp15 = new ExtractElementInst(packed_tmp7_71, const_int32_32, "tmp15", label_forbody_64); + StoreInst* void_73 = new StoreInst(float_tmp15, ptr_arrayidx13, false, label_forbody_64); std::vector ptr_arrayidx17_indices; - ptr_arrayidx17_indices.push_back(int32_i_0_reg2mem_0_72); - ptr_arrayidx17_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx17 = new GetElementPtrInst(ptr_dests, ptr_arrayidx17_indices.begin(), ptr_arrayidx17_indices.end(), "arrayidx17", label_forbody_68); - ExtractElementInst* float_tmp19 = new ExtractElementInst(packed_tmp7_75, const_int32_37, "tmp19", label_forbody_68); - StoreInst* void_78 = new StoreInst(float_tmp19, ptr_arrayidx17, false, label_forbody_68); + ptr_arrayidx17_indices.push_back(int32_i_0_reg2mem_0_68); + ptr_arrayidx17_indices.push_back(const_int32_33); + Instruction* ptr_arrayidx17 = new GetElementPtrInst(ptr_dests, ptr_arrayidx17_indices.begin(), ptr_arrayidx17_indices.end(), "arrayidx17", label_forbody_64); + ExtractElementInst* float_tmp19 = new ExtractElementInst(packed_tmp7_71, const_int32_33, "tmp19", label_forbody_64); + StoreInst* void_74 = new StoreInst(float_tmp19, ptr_arrayidx17, false, label_forbody_64); std::vector ptr_arrayidx21_indices; - ptr_arrayidx21_indices.push_back(int32_i_0_reg2mem_0_72); - ptr_arrayidx21_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx21 = new GetElementPtrInst(ptr_dests, ptr_arrayidx21_indices.begin(), ptr_arrayidx21_indices.end(), "arrayidx21", label_forbody_68); - ExtractElementInst* float_tmp23 = new ExtractElementInst(packed_tmp7_75, const_int32_38, "tmp23", label_forbody_68); - StoreInst* void_79 = new StoreInst(float_tmp23, ptr_arrayidx21, false, label_forbody_68); - BinaryOperator* int32_indvar_next_80 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_72, const_int32_36, "indvar.next", label_forbody_68); - ICmpInst* int1_exitcond_81 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_80, int32_num_attribs_66, "exitcond", label_forbody_68); - new BranchInst(label_afterfor_69, label_forbody_68, int1_exitcond_81, label_forbody_68); - - // Block afterfor (label_afterfor_69) - new ReturnInst(label_afterfor_69); + ptr_arrayidx21_indices.push_back(int32_i_0_reg2mem_0_68); + ptr_arrayidx21_indices.push_back(const_int32_34); + Instruction* ptr_arrayidx21 = new GetElementPtrInst(ptr_dests, ptr_arrayidx21_indices.begin(), ptr_arrayidx21_indices.end(), "arrayidx21", label_forbody_64); + ExtractElementInst* float_tmp23 = new ExtractElementInst(packed_tmp7_71, const_int32_34, "tmp23", label_forbody_64); + StoreInst* void_75 = new StoreInst(float_tmp23, ptr_arrayidx21, false, label_forbody_64); + BinaryOperator* int32_indvar_next_76 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_68, const_int32_32, "indvar.next", label_forbody_64); + ICmpInst* int1_exitcond_77 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_76, int32_num_attribs_62, "exitcond", label_forbody_64); + new BranchInst(label_afterfor_65, label_forbody_64, int1_exitcond_77, label_forbody_64); + + // Block afterfor (label_afterfor_65) + new ReturnInst(label_afterfor_65); // Resolve Forward References - fwdref_73->replaceAllUsesWith(int32_indvar_next_80); delete fwdref_73; + fwdref_69->replaceAllUsesWith(int32_indvar_next_76); delete fwdref_69; } // Function: run_vertex_shader (func_run_vertex_shader) { Function::arg_iterator args = func_run_vertex_shader->arg_begin(); - Value* ptr_ainputs_84 = args++; - ptr_ainputs_84->setName("ainputs"); - Value* ptr_dests_85 = args++; - ptr_dests_85->setName("dests"); + Value* ptr_inputs = args++; + ptr_inputs->setName("inputs"); + Value* ptr_results = args++; + ptr_results->setName("results"); Value* ptr_aconsts = args++; ptr_aconsts->setName("aconsts"); Value* int32_num_vertices = args++; int32_num_vertices->setName("num_vertices"); Value* int32_num_inputs = args++; int32_num_inputs->setName("num_inputs"); - Value* int32_num_attribs_86 = args++; - int32_num_attribs_86->setName("num_attribs"); + Value* int32_num_attribs_80 = args++; + int32_num_attribs_80->setName("num_attribs"); Value* int32_num_consts = args++; int32_num_consts->setName("num_consts"); - BasicBlock* label_entry_87 = new BasicBlock("entry",func_run_vertex_shader,0); - BasicBlock* label_forbody6_i = new BasicBlock("forbody6.i",func_run_vertex_shader,0); - BasicBlock* label_forinc57_i = new BasicBlock("forinc57.i",func_run_vertex_shader,0); - BasicBlock* label_from_array_exit = new BasicBlock("from_array.exit",func_run_vertex_shader,0); - BasicBlock* label_forbody_i15 = new BasicBlock("forbody.i15",func_run_vertex_shader,0); + BasicBlock* label_entry_81 = new BasicBlock("entry",func_run_vertex_shader,0); + BasicBlock* label_forbody_i = new BasicBlock("forbody.i",func_run_vertex_shader,0); BasicBlock* label_from_consts_exit = new BasicBlock("from_consts.exit",func_run_vertex_shader,0); BasicBlock* label_forbody_preheader = new BasicBlock("forbody.preheader",func_run_vertex_shader,0); - BasicBlock* label_forbody_us = new BasicBlock("forbody.us",func_run_vertex_shader,0); - BasicBlock* label_to_array_exit_us = new BasicBlock("to_array.exit.us",func_run_vertex_shader,0); - BasicBlock* label_forbody_i_us = new BasicBlock("forbody.i.us",func_run_vertex_shader,0); - BasicBlock* label_forbody_88 = new BasicBlock("forbody",func_run_vertex_shader,0); - BasicBlock* label_afterfor_89 = new BasicBlock("afterfor",func_run_vertex_shader,0); - - // Block entry (label_entry_87) - AllocaInst* ptr_inputs = new AllocaInst(ArrayTy_21, "inputs", label_entry_87); - AllocaInst* ptr_consts = new AllocaInst(ArrayTy_23, "consts", label_entry_87); - AllocaInst* ptr_results = new AllocaInst(ArrayTy_21, "results", label_entry_87); - AllocaInst* ptr_temps = new AllocaInst(ArrayTy_25, "temps", label_entry_87); - AllocaInst* ptr_args = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_87); - ICmpInst* int1_cmp_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_vertices, const_int32_34, "cmp.i", label_entry_87); - ICmpInst* int1_cmp5_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_inputs, const_int32_34, "cmp5.i", label_entry_87); - BinaryOperator* int1_bothcond_i = BinaryOperator::create(Instruction::And, int1_cmp5_i, int1_cmp_i, "bothcond.i", label_entry_87); - new BranchInst(label_forbody6_i, label_from_array_exit, int1_bothcond_i, label_entry_87); + BasicBlock* label_forbody_82 = new BasicBlock("forbody",func_run_vertex_shader,0); + BasicBlock* label_afterfor_83 = new BasicBlock("afterfor",func_run_vertex_shader,0); + + // Block entry (label_entry_81) + AllocaInst* ptr_consts = new AllocaInst(ArrayTy_21, "consts", label_entry_81); + AllocaInst* ptr_temps = new AllocaInst(ArrayTy_23, "temps", label_entry_81); + AllocaInst* ptr_args = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_81); + ICmpInst* int1_cmp_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts, const_int32_30, "cmp.i", label_entry_81); + new BranchInst(label_forbody_i, label_from_consts_exit, int1_cmp_i, label_entry_81); + + // Block forbody.i (label_forbody_i) + Argument* fwdref_85 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_i = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i", label_forbody_i); + int32_i_0_reg2mem_0_i->reserveOperandSpace(2); + int32_i_0_reg2mem_0_i->addIncoming(const_int32_30, label_entry_81); + int32_i_0_reg2mem_0_i->addIncoming(fwdref_85, label_forbody_i); + + Argument* fwdref_86 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody_i); + packed_vec_0_reg2mem_0_i->reserveOperandSpace(2); + packed_vec_0_reg2mem_0_i->addIncoming(const_packed_31, label_entry_81); + packed_vec_0_reg2mem_0_i->addIncoming(fwdref_86, label_forbody_i); - // Block forbody6.i (label_forbody6_i) - Argument* fwdref_91 = new Argument(IntegerType::get(32)); - Argument* fwdref_92 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_i_ph = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i.ph", label_forbody6_i); - int32_i_0_reg2mem_0_i_ph->reserveOperandSpace(3); - int32_i_0_reg2mem_0_i_ph->addIncoming(const_int32_34, label_entry_87); - int32_i_0_reg2mem_0_i_ph->addIncoming(fwdref_91, label_forinc57_i); - int32_i_0_reg2mem_0_i_ph->addIncoming(fwdref_92, label_forbody6_i); - - Argument* fwdref_93 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0_i = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i", label_forbody6_i); - int32_j_0_reg2mem_0_i->reserveOperandSpace(3); - int32_j_0_reg2mem_0_i->addIncoming(fwdref_93, label_forbody6_i); - int32_j_0_reg2mem_0_i->addIncoming(const_int32_34, label_forinc57_i); - int32_j_0_reg2mem_0_i->addIncoming(const_int32_34, label_entry_87); - - Argument* fwdref_94 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody6_i); - packed_vec_0_reg2mem_0_i->reserveOperandSpace(3); - packed_vec_0_reg2mem_0_i->addIncoming(fwdref_94, label_forbody6_i); - packed_vec_0_reg2mem_0_i->addIncoming(const_packed_35, label_entry_87); - packed_vec_0_reg2mem_0_i->addIncoming(fwdref_94, label_forinc57_i); - - std::vector ptr_arraydecay11_i_indices; - ptr_arraydecay11_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); - ptr_arraydecay11_i_indices.push_back(int32_j_0_reg2mem_0_i); - ptr_arraydecay11_i_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay11_i = new GetElementPtrInst(ptr_ainputs_84, ptr_arraydecay11_i_indices.begin(), ptr_arraydecay11_i_indices.end(), "arraydecay11.i", label_forbody6_i); - LoadInst* float_tmp13_i = new LoadInst(ptr_arraydecay11_i, "tmp13.i", false, label_forbody6_i); - InsertElementInst* packed_tmp15_i = new InsertElementInst(packed_vec_0_reg2mem_0_i, float_tmp13_i, const_int32_34, "tmp15.i", label_forbody6_i); - std::vector ptr_arrayidx23_i_indices; - ptr_arrayidx23_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); - ptr_arrayidx23_i_indices.push_back(int32_j_0_reg2mem_0_i); - ptr_arrayidx23_i_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx23_i = new GetElementPtrInst(ptr_ainputs_84, ptr_arrayidx23_i_indices.begin(), ptr_arrayidx23_i_indices.end(), "arrayidx23.i", label_forbody6_i); - LoadInst* float_tmp24_i = new LoadInst(ptr_arrayidx23_i, "tmp24.i", false, label_forbody6_i); - InsertElementInst* packed_tmp26_i = new InsertElementInst(packed_tmp15_i, float_tmp24_i, const_int32_36, "tmp26.i", label_forbody6_i); - std::vector ptr_arrayidx34_i_indices; - ptr_arrayidx34_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); - ptr_arrayidx34_i_indices.push_back(int32_j_0_reg2mem_0_i); - ptr_arrayidx34_i_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx34_i = new GetElementPtrInst(ptr_ainputs_84, ptr_arrayidx34_i_indices.begin(), ptr_arrayidx34_i_indices.end(), "arrayidx34.i", label_forbody6_i); - LoadInst* float_tmp35_i = new LoadInst(ptr_arrayidx34_i, "tmp35.i", false, label_forbody6_i); - InsertElementInst* packed_tmp37_i = new InsertElementInst(packed_tmp26_i, float_tmp35_i, const_int32_37, "tmp37.i", label_forbody6_i); - std::vector ptr_arrayidx45_i_indices; - ptr_arrayidx45_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); - ptr_arrayidx45_i_indices.push_back(int32_j_0_reg2mem_0_i); - ptr_arrayidx45_i_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx45_i = new GetElementPtrInst(ptr_ainputs_84, ptr_arrayidx45_i_indices.begin(), ptr_arrayidx45_i_indices.end(), "arrayidx45.i", label_forbody6_i); - LoadInst* float_tmp46_i = new LoadInst(ptr_arrayidx45_i, "tmp46.i", false, label_forbody6_i); - InsertElementInst* packed_tmp48_i = new InsertElementInst(packed_tmp37_i, float_tmp46_i, const_int32_38, "tmp48.i", label_forbody6_i); - std::vector ptr_arrayidx54_i_indices; - ptr_arrayidx54_i_indices.push_back(const_int32_34); - ptr_arrayidx54_i_indices.push_back(int32_i_0_reg2mem_0_i_ph); - ptr_arrayidx54_i_indices.push_back(int32_j_0_reg2mem_0_i); - Instruction* ptr_arrayidx54_i = new GetElementPtrInst(ptr_inputs, ptr_arrayidx54_i_indices.begin(), ptr_arrayidx54_i_indices.end(), "arrayidx54.i", label_forbody6_i); - StoreInst* void_95 = new StoreInst(packed_tmp48_i, ptr_arrayidx54_i, false, label_forbody6_i); - BinaryOperator* int32_inc_i = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i, const_int32_36, "inc.i", label_forbody6_i); - ICmpInst* int1_cmp59_i = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i, int32_num_inputs, "cmp59.i", label_forbody6_i); - new BranchInst(label_forbody6_i, label_forinc57_i, int1_cmp59_i, label_forbody6_i); - - // Block forinc57.i (label_forinc57_i) - BinaryOperator* int32_inc59_i = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i_ph, const_int32_36, "inc59.i", label_forinc57_i); - ICmpInst* int1_cmp17_i = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc59_i, int32_num_vertices, "cmp17.i", label_forinc57_i); - new BranchInst(label_forbody6_i, label_from_array_exit, int1_cmp17_i, label_forinc57_i); - - // Block from_array.exit (label_from_array_exit) - ICmpInst* int1_cmp_i4 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts, const_int32_34, "cmp.i4", label_from_array_exit); - new BranchInst(label_forbody_i15, label_from_consts_exit, int1_cmp_i4, label_from_array_exit); - - // Block forbody.i15 (label_forbody_i15) - Argument* fwdref_99 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_i5 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i5", label_forbody_i15); - int32_i_0_reg2mem_0_i5->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i5->addIncoming(const_int32_34, label_from_array_exit); - int32_i_0_reg2mem_0_i5->addIncoming(fwdref_99, label_forbody_i15); - - Argument* fwdref_100 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i6 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i6", label_forbody_i15); - packed_vec_0_reg2mem_0_i6->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i6->addIncoming(const_packed_35, label_from_array_exit); - packed_vec_0_reg2mem_0_i6->addIncoming(fwdref_100, label_forbody_i15); - - std::vector ptr_arraydecay_i7_indices; - ptr_arraydecay_i7_indices.push_back(int32_i_0_reg2mem_0_i5); - ptr_arraydecay_i7_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay_i7 = new GetElementPtrInst(ptr_aconsts, ptr_arraydecay_i7_indices.begin(), ptr_arraydecay_i7_indices.end(), "arraydecay.i7", label_forbody_i15); - LoadInst* float_tmp5_i = new LoadInst(ptr_arraydecay_i7, "tmp5.i", false, label_forbody_i15); - InsertElementInst* packed_tmp7_i8 = new InsertElementInst(packed_vec_0_reg2mem_0_i6, float_tmp5_i, const_int32_34, "tmp7.i8", label_forbody_i15); + std::vector ptr_arraydecay_i_indices; + ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_i); + ptr_arraydecay_i_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay_i = new GetElementPtrInst(ptr_aconsts, ptr_arraydecay_i_indices.begin(), ptr_arraydecay_i_indices.end(), "arraydecay.i", label_forbody_i); + LoadInst* float_tmp5_i = new LoadInst(ptr_arraydecay_i, "tmp5.i", false, label_forbody_i); + InsertElementInst* packed_tmp7_i = new InsertElementInst(packed_vec_0_reg2mem_0_i, float_tmp5_i, const_int32_30, "tmp7.i", label_forbody_i); std::vector ptr_arrayidx12_i_indices; - ptr_arrayidx12_i_indices.push_back(int32_i_0_reg2mem_0_i5); - ptr_arrayidx12_i_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx12_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx12_i_indices.begin(), ptr_arrayidx12_i_indices.end(), "arrayidx12.i", label_forbody_i15); - LoadInst* float_tmp13_i9 = new LoadInst(ptr_arrayidx12_i, "tmp13.i9", false, label_forbody_i15); - InsertElementInst* packed_tmp15_i10 = new InsertElementInst(packed_tmp7_i8, float_tmp13_i9, const_int32_36, "tmp15.i10", label_forbody_i15); + ptr_arrayidx12_i_indices.push_back(int32_i_0_reg2mem_0_i); + ptr_arrayidx12_i_indices.push_back(const_int32_32); + Instruction* ptr_arrayidx12_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx12_i_indices.begin(), ptr_arrayidx12_i_indices.end(), "arrayidx12.i", label_forbody_i); + LoadInst* float_tmp13_i = new LoadInst(ptr_arrayidx12_i, "tmp13.i", false, label_forbody_i); + InsertElementInst* packed_tmp15_i = new InsertElementInst(packed_tmp7_i, float_tmp13_i, const_int32_32, "tmp15.i", label_forbody_i); std::vector ptr_arrayidx20_i_indices; - ptr_arrayidx20_i_indices.push_back(int32_i_0_reg2mem_0_i5); - ptr_arrayidx20_i_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx20_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx20_i_indices.begin(), ptr_arrayidx20_i_indices.end(), "arrayidx20.i", label_forbody_i15); - LoadInst* float_tmp21_i = new LoadInst(ptr_arrayidx20_i, "tmp21.i", false, label_forbody_i15); - InsertElementInst* packed_tmp23_i11 = new InsertElementInst(packed_tmp15_i10, float_tmp21_i, const_int32_37, "tmp23.i11", label_forbody_i15); + ptr_arrayidx20_i_indices.push_back(int32_i_0_reg2mem_0_i); + ptr_arrayidx20_i_indices.push_back(const_int32_33); + Instruction* ptr_arrayidx20_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx20_i_indices.begin(), ptr_arrayidx20_i_indices.end(), "arrayidx20.i", label_forbody_i); + LoadInst* float_tmp21_i = new LoadInst(ptr_arrayidx20_i, "tmp21.i", false, label_forbody_i); + InsertElementInst* packed_tmp23_i = new InsertElementInst(packed_tmp15_i, float_tmp21_i, const_int32_33, "tmp23.i", label_forbody_i); std::vector ptr_arrayidx28_i_indices; - ptr_arrayidx28_i_indices.push_back(int32_i_0_reg2mem_0_i5); - ptr_arrayidx28_i_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx28_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx28_i_indices.begin(), ptr_arrayidx28_i_indices.end(), "arrayidx28.i", label_forbody_i15); - LoadInst* float_tmp29_i = new LoadInst(ptr_arrayidx28_i, "tmp29.i", false, label_forbody_i15); - InsertElementInst* packed_tmp31_i = new InsertElementInst(packed_tmp23_i11, float_tmp29_i, const_int32_38, "tmp31.i", label_forbody_i15); - std::vector ptr_arrayidx34_i12_indices; - ptr_arrayidx34_i12_indices.push_back(const_int32_34); - ptr_arrayidx34_i12_indices.push_back(int32_i_0_reg2mem_0_i5); - Instruction* ptr_arrayidx34_i12 = new GetElementPtrInst(ptr_consts, ptr_arrayidx34_i12_indices.begin(), ptr_arrayidx34_i12_indices.end(), "arrayidx34.i12", label_forbody_i15); - StoreInst* void_101 = new StoreInst(packed_tmp31_i, ptr_arrayidx34_i12, false, label_forbody_i15); - BinaryOperator* int32_indvar_next24 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i5, const_int32_36, "indvar.next24", label_forbody_i15); - ICmpInst* int1_exitcond25 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next24, int32_num_consts, "exitcond25", label_forbody_i15); - new BranchInst(label_from_consts_exit, label_forbody_i15, int1_exitcond25, label_forbody_i15); + ptr_arrayidx28_i_indices.push_back(int32_i_0_reg2mem_0_i); + ptr_arrayidx28_i_indices.push_back(const_int32_34); + Instruction* ptr_arrayidx28_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx28_i_indices.begin(), ptr_arrayidx28_i_indices.end(), "arrayidx28.i", label_forbody_i); + LoadInst* float_tmp29_i = new LoadInst(ptr_arrayidx28_i, "tmp29.i", false, label_forbody_i); + InsertElementInst* packed_tmp31_i = new InsertElementInst(packed_tmp23_i, float_tmp29_i, const_int32_34, "tmp31.i", label_forbody_i); + std::vector ptr_arrayidx34_i_indices; + ptr_arrayidx34_i_indices.push_back(const_int32_30); + ptr_arrayidx34_i_indices.push_back(int32_i_0_reg2mem_0_i); + Instruction* ptr_arrayidx34_i = new GetElementPtrInst(ptr_consts, ptr_arrayidx34_i_indices.begin(), ptr_arrayidx34_i_indices.end(), "arrayidx34.i", label_forbody_i); + StoreInst* void_87 = new StoreInst(packed_tmp31_i, ptr_arrayidx34_i, false, label_forbody_i); + BinaryOperator* int32_indvar_next6 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i, const_int32_32, "indvar.next6", label_forbody_i); + ICmpInst* int1_exitcond7 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next6, int32_num_consts, "exitcond7", label_forbody_i); + new BranchInst(label_from_consts_exit, label_forbody_i, int1_exitcond7, label_forbody_i); // Block from_consts.exit (label_from_consts_exit) - std::vector ptr_tmp6_indices; - ptr_tmp6_indices.push_back(const_int32_34); - ptr_tmp6_indices.push_back(const_int32_38); - Instruction* ptr_tmp6 = new GetElementPtrInst(ptr_args, ptr_tmp6_indices.begin(), ptr_tmp6_indices.end(), "tmp6", label_from_consts_exit); - std::vector ptr_arraydecay7_indices; - ptr_arraydecay7_indices.push_back(const_int32_34); - ptr_arraydecay7_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay7 = new GetElementPtrInst(ptr_consts, ptr_arraydecay7_indices.begin(), ptr_arraydecay7_indices.end(), "arraydecay7", label_from_consts_exit); - StoreInst* void_103 = new StoreInst(ptr_arraydecay7, ptr_tmp6, false, label_from_consts_exit); - std::vector ptr_tmp8_indices; - ptr_tmp8_indices.push_back(const_int32_34); - ptr_tmp8_indices.push_back(const_int32_37); - Instruction* ptr_tmp8 = new GetElementPtrInst(ptr_args, ptr_tmp8_indices.begin(), ptr_tmp8_indices.end(), "tmp8", label_from_consts_exit); - std::vector ptr_arraydecay9_indices; - ptr_arraydecay9_indices.push_back(const_int32_34); - ptr_arraydecay9_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay9 = new GetElementPtrInst(ptr_temps, ptr_arraydecay9_indices.begin(), ptr_arraydecay9_indices.end(), "arraydecay9", label_from_consts_exit); - StoreInst* void_104 = new StoreInst(ptr_arraydecay9, ptr_tmp8, false, label_from_consts_exit); - new BranchInst(label_forbody_preheader, label_afterfor_89, int1_cmp_i, label_from_consts_exit); + std::vector ptr_tmp2_indices; + ptr_tmp2_indices.push_back(const_int32_30); + ptr_tmp2_indices.push_back(const_int32_34); + Instruction* ptr_tmp2 = new GetElementPtrInst(ptr_args, ptr_tmp2_indices.begin(), ptr_tmp2_indices.end(), "tmp2", label_from_consts_exit); + std::vector ptr_arraydecay3_indices; + ptr_arraydecay3_indices.push_back(const_int32_30); + ptr_arraydecay3_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay3 = new GetElementPtrInst(ptr_consts, ptr_arraydecay3_indices.begin(), ptr_arraydecay3_indices.end(), "arraydecay3", label_from_consts_exit); + StoreInst* void_89 = new StoreInst(ptr_arraydecay3, ptr_tmp2, false, label_from_consts_exit); + std::vector ptr_tmp4_indices; + ptr_tmp4_indices.push_back(const_int32_30); + ptr_tmp4_indices.push_back(const_int32_33); + Instruction* ptr_tmp4 = new GetElementPtrInst(ptr_args, ptr_tmp4_indices.begin(), ptr_tmp4_indices.end(), "tmp4", label_from_consts_exit); + std::vector ptr_arraydecay5_indices; + ptr_arraydecay5_indices.push_back(const_int32_30); + ptr_arraydecay5_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay5 = new GetElementPtrInst(ptr_temps, ptr_arraydecay5_indices.begin(), ptr_arraydecay5_indices.end(), "arraydecay5", label_from_consts_exit); + StoreInst* void_90 = new StoreInst(ptr_arraydecay5, ptr_tmp4, false, label_from_consts_exit); + ICmpInst* int1_cmp_91 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_vertices, const_int32_30, "cmp", label_from_consts_exit); + new BranchInst(label_forbody_preheader, label_afterfor_83, int1_cmp_91, label_from_consts_exit); // Block forbody.preheader (label_forbody_preheader) + std::vector ptr_tmp8_indices; + ptr_tmp8_indices.push_back(const_int32_30); + ptr_tmp8_indices.push_back(const_int32_30); + Instruction* ptr_tmp8 = new GetElementPtrInst(ptr_args, ptr_tmp8_indices.begin(), ptr_tmp8_indices.end(), "tmp8", label_forbody_preheader); std::vector ptr_tmp12_indices; - ptr_tmp12_indices.push_back(const_int32_34); - ptr_tmp12_indices.push_back(const_int32_34); + ptr_tmp12_indices.push_back(const_int32_30); + ptr_tmp12_indices.push_back(const_int32_32); Instruction* ptr_tmp12 = new GetElementPtrInst(ptr_args, ptr_tmp12_indices.begin(), ptr_tmp12_indices.end(), "tmp12", label_forbody_preheader); - std::vector ptr_tmp16_indices; - ptr_tmp16_indices.push_back(const_int32_34); - ptr_tmp16_indices.push_back(const_int32_36); - Instruction* ptr_tmp16 = new GetElementPtrInst(ptr_args, ptr_tmp16_indices.begin(), ptr_tmp16_indices.end(), "tmp16", label_forbody_preheader); - ICmpInst* int1_cmp_i1 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_86, const_int32_34, "cmp.i1", label_forbody_preheader); - new BranchInst(label_forbody_us, label_forbody_88, int1_cmp_i1, label_forbody_preheader); - - // Block forbody.us (label_forbody_us) - Argument* fwdref_107 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_us = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.us", label_forbody_us); - int32_i_0_reg2mem_0_us->reserveOperandSpace(2); - int32_i_0_reg2mem_0_us->addIncoming(const_int32_34, label_forbody_preheader); - int32_i_0_reg2mem_0_us->addIncoming(fwdref_107, label_to_array_exit_us); - - std::vector ptr_arraydecay15_us_indices; - ptr_arraydecay15_us_indices.push_back(const_int32_34); - ptr_arraydecay15_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arraydecay15_us_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay15_us = new GetElementPtrInst(ptr_results, ptr_arraydecay15_us_indices.begin(), ptr_arraydecay15_us_indices.end(), "arraydecay15.us", label_forbody_us); - StoreInst* void_108 = new StoreInst(ptr_arraydecay15_us, ptr_tmp12, false, label_forbody_us); - std::vector ptr_arraydecay20_us_indices; - ptr_arraydecay20_us_indices.push_back(const_int32_34); - ptr_arraydecay20_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arraydecay20_us_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay20_us = new GetElementPtrInst(ptr_inputs, ptr_arraydecay20_us_indices.begin(), ptr_arraydecay20_us_indices.end(), "arraydecay20.us", label_forbody_us); - StoreInst* void_109 = new StoreInst(ptr_arraydecay20_us, ptr_tmp16, false, label_forbody_us); - CallInst* void_110 = new CallInst(func_execute_shader, ptr_args, "", label_forbody_us); - void_110->setCallingConv(CallingConv::C); - void_110->setTailCall(false); - LoadInst* ptr_tmp26_us = new LoadInst(ptr_tmp12, "tmp26.us", false, label_forbody_us); - new BranchInst(label_forbody_i_us, label_forbody_us); - - // Block to_array.exit.us (label_to_array_exit_us) - BinaryOperator* int32_inc_us = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_us, const_int32_36, "inc.us", label_to_array_exit_us); - ICmpInst* int1_cmp21_us = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_us, int32_num_vertices, "cmp21.us", label_to_array_exit_us); - new BranchInst(label_forbody_us, label_afterfor_89, int1_cmp21_us, label_to_array_exit_us); - - // Block forbody.i.us (label_forbody_i_us) - Argument* fwdref_113 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_i2_us = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i2.us", label_forbody_i_us); - int32_i_0_reg2mem_0_i2_us->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i2_us->addIncoming(const_int32_34, label_forbody_us); - int32_i_0_reg2mem_0_i2_us->addIncoming(fwdref_113, label_forbody_i_us); - - std::vector ptr_arraydecay_i_us_indices; - ptr_arraydecay_i_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arraydecay_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - ptr_arraydecay_i_us_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay_i_us = new GetElementPtrInst(ptr_dests_85, ptr_arraydecay_i_us_indices.begin(), ptr_arraydecay_i_us_indices.end(), "arraydecay.i.us", label_forbody_i_us); - GetElementPtrInst* ptr_arrayidx6_i_us = new GetElementPtrInst(ptr_tmp26_us, int32_i_0_reg2mem_0_i2_us, "arrayidx6.i.us", label_forbody_i_us); - LoadInst* packed_tmp7_i_us = new LoadInst(ptr_arrayidx6_i_us, "tmp7.i.us", false, label_forbody_i_us); - ExtractElementInst* float_tmp11_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_34, "tmp11.i.us", label_forbody_i_us); - StoreInst* void_114 = new StoreInst(float_tmp11_i_us, ptr_arraydecay_i_us, false, label_forbody_i_us); - std::vector ptr_arrayidx13_i_us_indices; - ptr_arrayidx13_i_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arrayidx13_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - ptr_arrayidx13_i_us_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx13_i_us = new GetElementPtrInst(ptr_dests_85, ptr_arrayidx13_i_us_indices.begin(), ptr_arrayidx13_i_us_indices.end(), "arrayidx13.i.us", label_forbody_i_us); - ExtractElementInst* float_tmp15_i3_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_36, "tmp15.i3.us", label_forbody_i_us); - StoreInst* void_115 = new StoreInst(float_tmp15_i3_us, ptr_arrayidx13_i_us, false, label_forbody_i_us); - std::vector ptr_arrayidx17_i_us_indices; - ptr_arrayidx17_i_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arrayidx17_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - ptr_arrayidx17_i_us_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx17_i_us = new GetElementPtrInst(ptr_dests_85, ptr_arrayidx17_i_us_indices.begin(), ptr_arrayidx17_i_us_indices.end(), "arrayidx17.i.us", label_forbody_i_us); - ExtractElementInst* float_tmp19_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_37, "tmp19.i.us", label_forbody_i_us); - StoreInst* void_116 = new StoreInst(float_tmp19_i_us, ptr_arrayidx17_i_us, false, label_forbody_i_us); - std::vector ptr_arrayidx21_i_us_indices; - ptr_arrayidx21_i_us_indices.push_back(int32_i_0_reg2mem_0_us); - ptr_arrayidx21_i_us_indices.push_back(int32_i_0_reg2mem_0_i2_us); - ptr_arrayidx21_i_us_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx21_i_us = new GetElementPtrInst(ptr_dests_85, ptr_arrayidx21_i_us_indices.begin(), ptr_arrayidx21_i_us_indices.end(), "arrayidx21.i.us", label_forbody_i_us); - ExtractElementInst* float_tmp23_i_us = new ExtractElementInst(packed_tmp7_i_us, const_int32_38, "tmp23.i.us", label_forbody_i_us); - StoreInst* void_117 = new StoreInst(float_tmp23_i_us, ptr_arrayidx21_i_us, false, label_forbody_i_us); - BinaryOperator* int32_indvar_next_118 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i2_us, const_int32_36, "indvar.next", label_forbody_i_us); - ICmpInst* int1_exitcond_119 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_118, int32_num_attribs_86, "exitcond", label_forbody_i_us); - new BranchInst(label_to_array_exit_us, label_forbody_i_us, int1_exitcond_119, label_forbody_i_us); - - // Block forbody (label_forbody_88) - Argument* fwdref_122 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_121 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_88); - int32_i_0_reg2mem_0_121->reserveOperandSpace(2); - int32_i_0_reg2mem_0_121->addIncoming(const_int32_34, label_forbody_preheader); - int32_i_0_reg2mem_0_121->addIncoming(fwdref_122, label_forbody_88); - - std::vector ptr_arraydecay15_indices; - ptr_arraydecay15_indices.push_back(const_int32_34); - ptr_arraydecay15_indices.push_back(int32_i_0_reg2mem_0_121); - ptr_arraydecay15_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay15 = new GetElementPtrInst(ptr_results, ptr_arraydecay15_indices.begin(), ptr_arraydecay15_indices.end(), "arraydecay15", label_forbody_88); - StoreInst* void_123 = new StoreInst(ptr_arraydecay15, ptr_tmp12, false, label_forbody_88); - std::vector ptr_arraydecay20_indices; - ptr_arraydecay20_indices.push_back(const_int32_34); - ptr_arraydecay20_indices.push_back(int32_i_0_reg2mem_0_121); - ptr_arraydecay20_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay20 = new GetElementPtrInst(ptr_inputs, ptr_arraydecay20_indices.begin(), ptr_arraydecay20_indices.end(), "arraydecay20", label_forbody_88); - StoreInst* void_124 = new StoreInst(ptr_arraydecay20, ptr_tmp16, false, label_forbody_88); - CallInst* void_125 = new CallInst(func_execute_shader, ptr_args, "", label_forbody_88); - void_125->setCallingConv(CallingConv::C); - void_125->setTailCall(false); - BinaryOperator* int32_inc_126 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_121, const_int32_36, "inc", label_forbody_88); - ICmpInst* int1_cmp21 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_126, int32_num_vertices, "cmp21", label_forbody_88); - new BranchInst(label_forbody_88, label_afterfor_89, int1_cmp21, label_forbody_88); - - // Block afterfor (label_afterfor_89) - new ReturnInst(label_afterfor_89); + new BranchInst(label_forbody_82, label_forbody_preheader); + + // Block forbody (label_forbody_82) + Argument* fwdref_95 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_94 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_82); + int32_i_0_reg2mem_0_94->reserveOperandSpace(2); + int32_i_0_reg2mem_0_94->addIncoming(const_int32_30, label_forbody_preheader); + int32_i_0_reg2mem_0_94->addIncoming(fwdref_95, label_forbody_82); + + std::vector ptr_arraydecay11_96_indices; + ptr_arraydecay11_96_indices.push_back(int32_i_0_reg2mem_0_94); + ptr_arraydecay11_96_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay11_96 = new GetElementPtrInst(ptr_results, ptr_arraydecay11_96_indices.begin(), ptr_arraydecay11_96_indices.end(), "arraydecay11", label_forbody_82); + StoreInst* void_97 = new StoreInst(ptr_arraydecay11_96, ptr_tmp8, false, label_forbody_82); + std::vector ptr_arraydecay16_indices; + ptr_arraydecay16_indices.push_back(int32_i_0_reg2mem_0_94); + ptr_arraydecay16_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay16 = new GetElementPtrInst(ptr_inputs, ptr_arraydecay16_indices.begin(), ptr_arraydecay16_indices.end(), "arraydecay16", label_forbody_82); + StoreInst* void_98 = new StoreInst(ptr_arraydecay16, ptr_tmp12, false, label_forbody_82); + CallInst* void_99 = new CallInst(func_execute_shader, ptr_args, "", label_forbody_82); + void_99->setCallingConv(CallingConv::C); + void_99->setTailCall(false); + BinaryOperator* int32_indvar_next_100 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_94, const_int32_32, "indvar.next", label_forbody_82); + ICmpInst* int1_exitcond_101 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_100, int32_num_vertices, "exitcond", label_forbody_82); + new BranchInst(label_afterfor_83, label_forbody_82, int1_exitcond_101, label_forbody_82); + + // Block afterfor (label_afterfor_83) + new ReturnInst(label_afterfor_83); // Resolve Forward References - fwdref_107->replaceAllUsesWith(int32_inc_us); delete fwdref_107; - fwdref_92->replaceAllUsesWith(int32_i_0_reg2mem_0_i_ph); delete fwdref_92; - fwdref_94->replaceAllUsesWith(packed_tmp48_i); delete fwdref_94; - fwdref_93->replaceAllUsesWith(int32_inc_i); delete fwdref_93; - fwdref_91->replaceAllUsesWith(int32_inc59_i); delete fwdref_91; - fwdref_100->replaceAllUsesWith(packed_tmp31_i); delete fwdref_100; - fwdref_99->replaceAllUsesWith(int32_indvar_next24); delete fwdref_99; - fwdref_113->replaceAllUsesWith(int32_indvar_next_118); delete fwdref_113; - fwdref_122->replaceAllUsesWith(int32_inc_126); delete fwdref_122; + fwdref_86->replaceAllUsesWith(packed_tmp31_i); delete fwdref_86; + fwdref_85->replaceAllUsesWith(int32_indvar_next6); delete fwdref_85; + fwdref_95->replaceAllUsesWith(int32_indvar_next_100); delete fwdref_95; } @@ -780,441 +613,180 @@ Module* createBaseShader() { float_x->setName("x"); Value* float_y = args++; float_y->setName("y"); - Value* ptr_dests_129 = args++; - ptr_dests_129->setName("dests"); - Value* ptr_ainputs_130 = args++; - ptr_ainputs_130->setName("ainputs"); - Value* int32_num_inputs_131 = args++; - int32_num_inputs_131->setName("num_inputs"); - Value* ptr_aconsts_132 = args++; - ptr_aconsts_132->setName("aconsts"); - Value* int32_num_consts_133 = args++; - int32_num_consts_133->setName("num_consts"); + Value* ptr_results_104 = args++; + ptr_results_104->setName("results"); + Value* ptr_inputs_105 = args++; + ptr_inputs_105->setName("inputs"); + Value* int32_num_inputs_106 = args++; + int32_num_inputs_106->setName("num_inputs"); + Value* ptr_aconsts_107 = args++; + ptr_aconsts_107->setName("aconsts"); + Value* int32_num_consts_108 = args++; + int32_num_consts_108->setName("num_consts"); Value* ptr_samplers = args++; ptr_samplers->setName("samplers"); - BasicBlock* label_entry_134 = new BasicBlock("entry",func_run_fragment_shader,0); - BasicBlock* label_forbody6_i_135 = new BasicBlock("forbody6.i",func_run_fragment_shader,0); - BasicBlock* label_from_array_exit_136 = new BasicBlock("from_array.exit",func_run_fragment_shader,0); - BasicBlock* label_forbody_i13 = new BasicBlock("forbody.i13",func_run_fragment_shader,0); - BasicBlock* label_from_consts_exit_137 = new BasicBlock("from_consts.exit",func_run_fragment_shader,0); - BasicBlock* label_forbody_138 = new BasicBlock("forbody",func_run_fragment_shader,0); - BasicBlock* label_afterfor_139 = new BasicBlock("afterfor",func_run_fragment_shader,0); - BasicBlock* label_forbody6_i_1 = new BasicBlock("forbody6.i.1",func_run_fragment_shader,0); - BasicBlock* label_forbody6_i_2 = new BasicBlock("forbody6.i.2",func_run_fragment_shader,0); - BasicBlock* label_forbody6_i_3 = new BasicBlock("forbody6.i.3",func_run_fragment_shader,0); + BasicBlock* label_entry_109 = new BasicBlock("entry",func_run_fragment_shader,0); + BasicBlock* label_forbody_i_110 = new BasicBlock("forbody.i",func_run_fragment_shader,0); + BasicBlock* label_from_consts_exit_111 = new BasicBlock("from_consts.exit",func_run_fragment_shader,0); - // Block entry (label_entry_134) - AllocaInst* ptr_inputs_140 = new AllocaInst(ArrayTy_33, "inputs", label_entry_134); - AllocaInst* ptr_consts_141 = new AllocaInst(ArrayTy_23, "consts", label_entry_134); - AllocaInst* ptr_results_142 = new AllocaInst(ArrayTy_33, "results", label_entry_134); - AllocaInst* ptr_temps_143 = new AllocaInst(ArrayTy_25, "temps", label_entry_134); - AllocaInst* ptr_args_144 = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_134); + // Block entry (label_entry_109) + AllocaInst* ptr_consts_112 = new AllocaInst(ArrayTy_21, "consts", label_entry_109); + AllocaInst* ptr_temps_113 = new AllocaInst(ArrayTy_23, "temps", label_entry_109); + AllocaInst* ptr_args_114 = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_109); std::vector ptr_tmp_indices; - ptr_tmp_indices.push_back(const_int32_34); - ptr_tmp_indices.push_back(const_int32_39); - Instruction* ptr_tmp = new GetElementPtrInst(ptr_args_144, ptr_tmp_indices.begin(), ptr_tmp_indices.end(), "tmp", label_entry_134); - StoreInst* void_145 = new StoreInst(const_int32_34, ptr_tmp, false, label_entry_134); - ICmpInst* int1_cmp5_i_146 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_inputs_131, const_int32_34, "cmp5.i", label_entry_134); - new BranchInst(label_forbody6_i_135, label_from_array_exit_136, int1_cmp5_i_146, label_entry_134); - - // Block forbody6.i (label_forbody6_i_135) - Argument* fwdref_149 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0_i_148 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i", label_forbody6_i_135); - int32_j_0_reg2mem_0_i_148->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_148->addIncoming(const_int32_34, label_entry_134); - int32_j_0_reg2mem_0_i_148->addIncoming(fwdref_149, label_forbody6_i_135); - - Argument* fwdref_151 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i_150 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody6_i_135); - packed_vec_0_reg2mem_0_i_150->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_150->addIncoming(const_packed_35, label_entry_134); - packed_vec_0_reg2mem_0_i_150->addIncoming(fwdref_151, label_forbody6_i_135); - - std::vector ptr_arraydecay11_i_152_indices; - ptr_arraydecay11_i_152_indices.push_back(const_int32_34); - ptr_arraydecay11_i_152_indices.push_back(int32_j_0_reg2mem_0_i_148); - ptr_arraydecay11_i_152_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay11_i_152 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_152_indices.begin(), ptr_arraydecay11_i_152_indices.end(), "arraydecay11.i", label_forbody6_i_135); - LoadInst* float_tmp13_i_153 = new LoadInst(ptr_arraydecay11_i_152, "tmp13.i", false, label_forbody6_i_135); - InsertElementInst* packed_tmp15_i_154 = new InsertElementInst(packed_vec_0_reg2mem_0_i_150, float_tmp13_i_153, const_int32_34, "tmp15.i", label_forbody6_i_135); - std::vector ptr_arrayidx23_i_155_indices; - ptr_arrayidx23_i_155_indices.push_back(const_int32_34); - ptr_arrayidx23_i_155_indices.push_back(int32_j_0_reg2mem_0_i_148); - ptr_arrayidx23_i_155_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx23_i_155 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_155_indices.begin(), ptr_arrayidx23_i_155_indices.end(), "arrayidx23.i", label_forbody6_i_135); - LoadInst* float_tmp24_i_156 = new LoadInst(ptr_arrayidx23_i_155, "tmp24.i", false, label_forbody6_i_135); - InsertElementInst* packed_tmp26_i_157 = new InsertElementInst(packed_tmp15_i_154, float_tmp24_i_156, const_int32_36, "tmp26.i", label_forbody6_i_135); - std::vector ptr_arrayidx34_i_158_indices; - ptr_arrayidx34_i_158_indices.push_back(const_int32_34); - ptr_arrayidx34_i_158_indices.push_back(int32_j_0_reg2mem_0_i_148); - ptr_arrayidx34_i_158_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx34_i_158 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_158_indices.begin(), ptr_arrayidx34_i_158_indices.end(), "arrayidx34.i", label_forbody6_i_135); - LoadInst* float_tmp35_i_159 = new LoadInst(ptr_arrayidx34_i_158, "tmp35.i", false, label_forbody6_i_135); - InsertElementInst* packed_tmp37_i_160 = new InsertElementInst(packed_tmp26_i_157, float_tmp35_i_159, const_int32_37, "tmp37.i", label_forbody6_i_135); - std::vector ptr_arrayidx45_i_161_indices; - ptr_arrayidx45_i_161_indices.push_back(const_int32_34); - ptr_arrayidx45_i_161_indices.push_back(int32_j_0_reg2mem_0_i_148); - ptr_arrayidx45_i_161_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx45_i_161 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_161_indices.begin(), ptr_arrayidx45_i_161_indices.end(), "arrayidx45.i", label_forbody6_i_135); - LoadInst* float_tmp46_i_162 = new LoadInst(ptr_arrayidx45_i_161, "tmp46.i", false, label_forbody6_i_135); - InsertElementInst* packed_tmp48_i_163 = new InsertElementInst(packed_tmp37_i_160, float_tmp46_i_162, const_int32_38, "tmp48.i", label_forbody6_i_135); - std::vector ptr_arrayidx54_i_164_indices; - ptr_arrayidx54_i_164_indices.push_back(const_int32_34); - ptr_arrayidx54_i_164_indices.push_back(const_int32_34); - ptr_arrayidx54_i_164_indices.push_back(int32_j_0_reg2mem_0_i_148); - Instruction* ptr_arrayidx54_i_164 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_164_indices.begin(), ptr_arrayidx54_i_164_indices.end(), "arrayidx54.i", label_forbody6_i_135); - StoreInst* void_165 = new StoreInst(packed_tmp48_i_163, ptr_arrayidx54_i_164, false, label_forbody6_i_135); - BinaryOperator* int32_inc_i_166 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_148, const_int32_36, "inc.i", label_forbody6_i_135); - ICmpInst* int1_cmp59_i_167 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_166, int32_num_inputs_131, "cmp59.i", label_forbody6_i_135); - new BranchInst(label_forbody6_i_135, label_forbody6_i_1, int1_cmp59_i_167, label_forbody6_i_135); - - // Block from_array.exit (label_from_array_exit_136) - ICmpInst* int1_cmp_i_169 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_133, const_int32_34, "cmp.i", label_from_array_exit_136); - new BranchInst(label_forbody_i13, label_from_consts_exit_137, int1_cmp_i_169, label_from_array_exit_136); - - // Block forbody.i13 (label_forbody_i13) - Argument* fwdref_171 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_i3 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i3", label_forbody_i13); - int32_i_0_reg2mem_0_i3->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i3->addIncoming(const_int32_34, label_from_array_exit_136); - int32_i_0_reg2mem_0_i3->addIncoming(fwdref_171, label_forbody_i13); - - Argument* fwdref_172 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i4 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i4", label_forbody_i13); - packed_vec_0_reg2mem_0_i4->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i4->addIncoming(const_packed_35, label_from_array_exit_136); - packed_vec_0_reg2mem_0_i4->addIncoming(fwdref_172, label_forbody_i13); - - std::vector ptr_arraydecay_i5_indices; - ptr_arraydecay_i5_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arraydecay_i5_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay_i5 = new GetElementPtrInst(ptr_aconsts_132, ptr_arraydecay_i5_indices.begin(), ptr_arraydecay_i5_indices.end(), "arraydecay.i5", label_forbody_i13); - LoadInst* float_tmp5_i_173 = new LoadInst(ptr_arraydecay_i5, "tmp5.i", false, label_forbody_i13); - InsertElementInst* packed_tmp7_i6 = new InsertElementInst(packed_vec_0_reg2mem_0_i4, float_tmp5_i_173, const_int32_34, "tmp7.i6", label_forbody_i13); - std::vector ptr_arrayidx12_i_174_indices; - ptr_arrayidx12_i_174_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx12_i_174_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx12_i_174 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx12_i_174_indices.begin(), ptr_arrayidx12_i_174_indices.end(), "arrayidx12.i", label_forbody_i13); - LoadInst* float_tmp13_i7 = new LoadInst(ptr_arrayidx12_i_174, "tmp13.i7", false, label_forbody_i13); - InsertElementInst* packed_tmp15_i8 = new InsertElementInst(packed_tmp7_i6, float_tmp13_i7, const_int32_36, "tmp15.i8", label_forbody_i13); - std::vector ptr_arrayidx20_i_175_indices; - ptr_arrayidx20_i_175_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx20_i_175_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx20_i_175 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx20_i_175_indices.begin(), ptr_arrayidx20_i_175_indices.end(), "arrayidx20.i", label_forbody_i13); - LoadInst* float_tmp21_i_176 = new LoadInst(ptr_arrayidx20_i_175, "tmp21.i", false, label_forbody_i13); - InsertElementInst* packed_tmp23_i9 = new InsertElementInst(packed_tmp15_i8, float_tmp21_i_176, const_int32_37, "tmp23.i9", label_forbody_i13); - std::vector ptr_arrayidx28_i_177_indices; - ptr_arrayidx28_i_177_indices.push_back(int32_i_0_reg2mem_0_i3); - ptr_arrayidx28_i_177_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx28_i_177 = new GetElementPtrInst(ptr_aconsts_132, ptr_arrayidx28_i_177_indices.begin(), ptr_arrayidx28_i_177_indices.end(), "arrayidx28.i", label_forbody_i13); - LoadInst* float_tmp29_i_178 = new LoadInst(ptr_arrayidx28_i_177, "tmp29.i", false, label_forbody_i13); - InsertElementInst* packed_tmp31_i_179 = new InsertElementInst(packed_tmp23_i9, float_tmp29_i_178, const_int32_38, "tmp31.i", label_forbody_i13); - std::vector ptr_arrayidx34_i10_indices; - ptr_arrayidx34_i10_indices.push_back(const_int32_34); - ptr_arrayidx34_i10_indices.push_back(int32_i_0_reg2mem_0_i3); - Instruction* ptr_arrayidx34_i10 = new GetElementPtrInst(ptr_consts_141, ptr_arrayidx34_i10_indices.begin(), ptr_arrayidx34_i10_indices.end(), "arrayidx34.i10", label_forbody_i13); - StoreInst* void_180 = new StoreInst(packed_tmp31_i_179, ptr_arrayidx34_i10, false, label_forbody_i13); - BinaryOperator* int32_indvar_next23 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i3, const_int32_36, "indvar.next23", label_forbody_i13); - ICmpInst* int1_exitcond24 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next23, int32_num_consts_133, "exitcond24", label_forbody_i13); - new BranchInst(label_from_consts_exit_137, label_forbody_i13, int1_exitcond24, label_forbody_i13); - - // Block from_consts.exit (label_from_consts_exit_137) - std::vector ptr_tmp6_182_indices; - ptr_tmp6_182_indices.push_back(const_int32_34); - ptr_tmp6_182_indices.push_back(const_int32_38); - Instruction* ptr_tmp6_182 = new GetElementPtrInst(ptr_args_144, ptr_tmp6_182_indices.begin(), ptr_tmp6_182_indices.end(), "tmp6", label_from_consts_exit_137); - std::vector ptr_arraydecay7_183_indices; - ptr_arraydecay7_183_indices.push_back(const_int32_34); - ptr_arraydecay7_183_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay7_183 = new GetElementPtrInst(ptr_consts_141, ptr_arraydecay7_183_indices.begin(), ptr_arraydecay7_183_indices.end(), "arraydecay7", label_from_consts_exit_137); - StoreInst* void_184 = new StoreInst(ptr_arraydecay7_183, ptr_tmp6_182, false, label_from_consts_exit_137); - std::vector ptr_tmp8_185_indices; - ptr_tmp8_185_indices.push_back(const_int32_34); - ptr_tmp8_185_indices.push_back(const_int32_37); - Instruction* ptr_tmp8_185 = new GetElementPtrInst(ptr_args_144, ptr_tmp8_185_indices.begin(), ptr_tmp8_185_indices.end(), "tmp8", label_from_consts_exit_137); - std::vector ptr_arraydecay9_186_indices; - ptr_arraydecay9_186_indices.push_back(const_int32_34); - ptr_arraydecay9_186_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay9_186 = new GetElementPtrInst(ptr_temps_143, ptr_arraydecay9_186_indices.begin(), ptr_arraydecay9_186_indices.end(), "arraydecay9", label_from_consts_exit_137); - StoreInst* void_187 = new StoreInst(ptr_arraydecay9_186, ptr_tmp8_185, false, label_from_consts_exit_137); - std::vector ptr_tmp11_indices; - ptr_tmp11_indices.push_back(const_int32_34); - ptr_tmp11_indices.push_back(const_int32_36); - Instruction* ptr_tmp11 = new GetElementPtrInst(ptr_args_144, ptr_tmp11_indices.begin(), ptr_tmp11_indices.end(), "tmp11", label_from_consts_exit_137); - std::vector ptr_tmp15_indices; - ptr_tmp15_indices.push_back(const_int32_34); - ptr_tmp15_indices.push_back(const_int32_34); - Instruction* ptr_tmp15 = new GetElementPtrInst(ptr_args_144, ptr_tmp15_indices.begin(), ptr_tmp15_indices.end(), "tmp15", label_from_consts_exit_137); - new BranchInst(label_forbody_138, label_from_consts_exit_137); - - // Block forbody (label_forbody_138) - Argument* fwdref_189 = new Argument(IntegerType::get(32)); - PHINode* int32_tmp21_rle = new PHINode(IntegerType::get(32), "tmp21.rle", label_forbody_138); - int32_tmp21_rle->reserveOperandSpace(2); - int32_tmp21_rle->addIncoming(const_int32_34, label_from_consts_exit_137); - int32_tmp21_rle->addIncoming(fwdref_189, label_forbody_138); - - Argument* fwdref_191 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_190 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_138); - int32_i_0_reg2mem_0_190->reserveOperandSpace(2); - int32_i_0_reg2mem_0_190->addIncoming(const_int32_34, label_from_consts_exit_137); - int32_i_0_reg2mem_0_190->addIncoming(fwdref_191, label_forbody_138); - - std::vector ptr_arraydecay14_indices; - ptr_arraydecay14_indices.push_back(const_int32_34); - ptr_arraydecay14_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arraydecay14_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay14 = new GetElementPtrInst(ptr_inputs_140, ptr_arraydecay14_indices.begin(), ptr_arraydecay14_indices.end(), "arraydecay14", label_forbody_138); - StoreInst* void_192 = new StoreInst(ptr_arraydecay14, ptr_tmp11, false, label_forbody_138); - std::vector ptr_arraydecay19_indices; - ptr_arraydecay19_indices.push_back(const_int32_34); - ptr_arraydecay19_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arraydecay19_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay19 = new GetElementPtrInst(ptr_results_142, ptr_arraydecay19_indices.begin(), ptr_arraydecay19_indices.end(), "arraydecay19", label_forbody_138); - StoreInst* void_193 = new StoreInst(ptr_arraydecay19, ptr_tmp15, false, label_forbody_138); - StoreInst* void_194 = new StoreInst(const_int32_34, ptr_tmp, false, label_forbody_138); - CallInst* void_195 = new CallInst(func_execute_shader, ptr_args_144, "", label_forbody_138); - void_195->setCallingConv(CallingConv::C); - void_195->setTailCall(false); - LoadInst* int32_tmp26 = new LoadInst(ptr_tmp, "tmp26", false, label_forbody_138); - BinaryOperator* int32_shl = BinaryOperator::create(Instruction::Shl, int32_tmp26, int32_i_0_reg2mem_0_190, "shl", label_forbody_138); - BinaryOperator* int32_or = BinaryOperator::create(Instruction::Or, int32_shl, int32_tmp21_rle, "or", label_forbody_138); - StoreInst* void_196 = new StoreInst(int32_or, ptr_tmp, false, label_forbody_138); - LoadInst* ptr_tmp33 = new LoadInst(ptr_tmp15, "tmp33", false, label_forbody_138); - std::vector ptr_arraydecay_i_indices; - ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arraydecay_i_indices.push_back(const_int32_34); - ptr_arraydecay_i_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay_i = new GetElementPtrInst(ptr_dests_129, ptr_arraydecay_i_indices.begin(), ptr_arraydecay_i_indices.end(), "arraydecay.i", label_forbody_138); - LoadInst* packed_tmp7_i = new LoadInst(ptr_tmp33, "tmp7.i", false, label_forbody_138); - ExtractElementInst* float_tmp11_i = new ExtractElementInst(packed_tmp7_i, const_int32_34, "tmp11.i", label_forbody_138); - StoreInst* void_197 = new StoreInst(float_tmp11_i, ptr_arraydecay_i, false, label_forbody_138); - std::vector ptr_arrayidx13_i_indices; - ptr_arrayidx13_i_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arrayidx13_i_indices.push_back(const_int32_34); - ptr_arrayidx13_i_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx13_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx13_i_indices.begin(), ptr_arrayidx13_i_indices.end(), "arrayidx13.i", label_forbody_138); - ExtractElementInst* float_tmp15_i2 = new ExtractElementInst(packed_tmp7_i, const_int32_36, "tmp15.i2", label_forbody_138); - StoreInst* void_198 = new StoreInst(float_tmp15_i2, ptr_arrayidx13_i, false, label_forbody_138); - std::vector ptr_arrayidx17_i_indices; - ptr_arrayidx17_i_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arrayidx17_i_indices.push_back(const_int32_34); - ptr_arrayidx17_i_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx17_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx17_i_indices.begin(), ptr_arrayidx17_i_indices.end(), "arrayidx17.i", label_forbody_138); - ExtractElementInst* float_tmp19_i = new ExtractElementInst(packed_tmp7_i, const_int32_37, "tmp19.i", label_forbody_138); - StoreInst* void_199 = new StoreInst(float_tmp19_i, ptr_arrayidx17_i, false, label_forbody_138); - std::vector ptr_arrayidx21_i_indices; - ptr_arrayidx21_i_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arrayidx21_i_indices.push_back(const_int32_34); - ptr_arrayidx21_i_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx21_i = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx21_i_indices.begin(), ptr_arrayidx21_i_indices.end(), "arrayidx21.i", label_forbody_138); - ExtractElementInst* float_tmp23_i = new ExtractElementInst(packed_tmp7_i, const_int32_38, "tmp23.i", label_forbody_138); - StoreInst* void_200 = new StoreInst(float_tmp23_i, ptr_arrayidx21_i, false, label_forbody_138); - std::vector ptr_arraydecay_i_1_indices; - ptr_arraydecay_i_1_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arraydecay_i_1_indices.push_back(const_int32_36); - ptr_arraydecay_i_1_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arraydecay_i_1_indices.begin(), ptr_arraydecay_i_1_indices.end(), "arraydecay.i.1", label_forbody_138); - GetElementPtrInst* ptr_arrayidx6_i_1 = new GetElementPtrInst(ptr_tmp33, const_int32_36, "arrayidx6.i.1", label_forbody_138); - LoadInst* packed_tmp7_i_1 = new LoadInst(ptr_arrayidx6_i_1, "tmp7.i.1", false, label_forbody_138); - ExtractElementInst* float_tmp11_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_34, "tmp11.i.1", label_forbody_138); - StoreInst* void_201 = new StoreInst(float_tmp11_i_1, ptr_arraydecay_i_1, false, label_forbody_138); - std::vector ptr_arrayidx13_i_1_indices; - ptr_arrayidx13_i_1_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arrayidx13_i_1_indices.push_back(const_int32_36); - ptr_arrayidx13_i_1_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx13_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx13_i_1_indices.begin(), ptr_arrayidx13_i_1_indices.end(), "arrayidx13.i.1", label_forbody_138); - ExtractElementInst* float_tmp15_i2_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_36, "tmp15.i2.1", label_forbody_138); - StoreInst* void_202 = new StoreInst(float_tmp15_i2_1, ptr_arrayidx13_i_1, false, label_forbody_138); - std::vector ptr_arrayidx17_i_1_indices; - ptr_arrayidx17_i_1_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arrayidx17_i_1_indices.push_back(const_int32_36); - ptr_arrayidx17_i_1_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx17_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx17_i_1_indices.begin(), ptr_arrayidx17_i_1_indices.end(), "arrayidx17.i.1", label_forbody_138); - ExtractElementInst* float_tmp19_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_37, "tmp19.i.1", label_forbody_138); - StoreInst* void_203 = new StoreInst(float_tmp19_i_1, ptr_arrayidx17_i_1, false, label_forbody_138); - std::vector ptr_arrayidx21_i_1_indices; - ptr_arrayidx21_i_1_indices.push_back(int32_i_0_reg2mem_0_190); - ptr_arrayidx21_i_1_indices.push_back(const_int32_36); - ptr_arrayidx21_i_1_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx21_i_1 = new GetElementPtrInst(ptr_dests_129, ptr_arrayidx21_i_1_indices.begin(), ptr_arrayidx21_i_1_indices.end(), "arrayidx21.i.1", label_forbody_138); - ExtractElementInst* float_tmp23_i_1 = new ExtractElementInst(packed_tmp7_i_1, const_int32_38, "tmp23.i.1", label_forbody_138); - StoreInst* void_204 = new StoreInst(float_tmp23_i_1, ptr_arrayidx21_i_1, false, label_forbody_138); - BinaryOperator* int32_indvar_next21 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_190, const_int32_36, "indvar.next21", label_forbody_138); - ICmpInst* int1_exitcond22 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next21, const_int32_39, "exitcond22", label_forbody_138); - new BranchInst(label_afterfor_139, label_forbody_138, int1_exitcond22, label_forbody_138); - - // Block afterfor (label_afterfor_139) - BinaryOperator* int32_neg = BinaryOperator::create(Instruction::Xor, int32_or, const_int32_40, "neg", label_afterfor_139); - new ReturnInst(int32_neg, label_afterfor_139); - - // Block forbody6.i.1 (label_forbody6_i_1) - Argument* fwdref_207 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0_i_1 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.1", label_forbody6_i_1); - int32_j_0_reg2mem_0_i_1->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_1->addIncoming(const_int32_34, label_forbody6_i_135); - int32_j_0_reg2mem_0_i_1->addIncoming(fwdref_207, label_forbody6_i_1); - - Argument* fwdref_208 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i_1 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.1", label_forbody6_i_1); - packed_vec_0_reg2mem_0_i_1->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_1->addIncoming(packed_tmp48_i_163, label_forbody6_i_135); - packed_vec_0_reg2mem_0_i_1->addIncoming(fwdref_208, label_forbody6_i_1); - - std::vector ptr_arraydecay11_i_1_indices; - ptr_arraydecay11_i_1_indices.push_back(const_int32_36); - ptr_arraydecay11_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - ptr_arraydecay11_i_1_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay11_i_1 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_1_indices.begin(), ptr_arraydecay11_i_1_indices.end(), "arraydecay11.i.1", label_forbody6_i_1); - LoadInst* float_tmp13_i_1 = new LoadInst(ptr_arraydecay11_i_1, "tmp13.i.1", false, label_forbody6_i_1); - InsertElementInst* packed_tmp15_i_1 = new InsertElementInst(packed_vec_0_reg2mem_0_i_1, float_tmp13_i_1, const_int32_34, "tmp15.i.1", label_forbody6_i_1); - std::vector ptr_arrayidx23_i_1_indices; - ptr_arrayidx23_i_1_indices.push_back(const_int32_36); - ptr_arrayidx23_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - ptr_arrayidx23_i_1_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx23_i_1 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_1_indices.begin(), ptr_arrayidx23_i_1_indices.end(), "arrayidx23.i.1", label_forbody6_i_1); - LoadInst* float_tmp24_i_1 = new LoadInst(ptr_arrayidx23_i_1, "tmp24.i.1", false, label_forbody6_i_1); - InsertElementInst* packed_tmp26_i_1 = new InsertElementInst(packed_tmp15_i_1, float_tmp24_i_1, const_int32_36, "tmp26.i.1", label_forbody6_i_1); - std::vector ptr_arrayidx34_i_1_indices; - ptr_arrayidx34_i_1_indices.push_back(const_int32_36); - ptr_arrayidx34_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - ptr_arrayidx34_i_1_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx34_i_1 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_1_indices.begin(), ptr_arrayidx34_i_1_indices.end(), "arrayidx34.i.1", label_forbody6_i_1); - LoadInst* float_tmp35_i_1 = new LoadInst(ptr_arrayidx34_i_1, "tmp35.i.1", false, label_forbody6_i_1); - InsertElementInst* packed_tmp37_i_1 = new InsertElementInst(packed_tmp26_i_1, float_tmp35_i_1, const_int32_37, "tmp37.i.1", label_forbody6_i_1); - std::vector ptr_arrayidx45_i_1_indices; - ptr_arrayidx45_i_1_indices.push_back(const_int32_36); - ptr_arrayidx45_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - ptr_arrayidx45_i_1_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx45_i_1 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_1_indices.begin(), ptr_arrayidx45_i_1_indices.end(), "arrayidx45.i.1", label_forbody6_i_1); - LoadInst* float_tmp46_i_1 = new LoadInst(ptr_arrayidx45_i_1, "tmp46.i.1", false, label_forbody6_i_1); - InsertElementInst* packed_tmp48_i_1 = new InsertElementInst(packed_tmp37_i_1, float_tmp46_i_1, const_int32_38, "tmp48.i.1", label_forbody6_i_1); - std::vector ptr_arrayidx54_i_1_indices; - ptr_arrayidx54_i_1_indices.push_back(const_int32_34); - ptr_arrayidx54_i_1_indices.push_back(const_int32_36); - ptr_arrayidx54_i_1_indices.push_back(int32_j_0_reg2mem_0_i_1); - Instruction* ptr_arrayidx54_i_1 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_1_indices.begin(), ptr_arrayidx54_i_1_indices.end(), "arrayidx54.i.1", label_forbody6_i_1); - StoreInst* void_209 = new StoreInst(packed_tmp48_i_1, ptr_arrayidx54_i_1, false, label_forbody6_i_1); - BinaryOperator* int32_inc_i_1 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_1, const_int32_36, "inc.i.1", label_forbody6_i_1); - ICmpInst* int1_cmp59_i_1 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_1, int32_num_inputs_131, "cmp59.i.1", label_forbody6_i_1); - new BranchInst(label_forbody6_i_1, label_forbody6_i_2, int1_cmp59_i_1, label_forbody6_i_1); - - // Block forbody6.i.2 (label_forbody6_i_2) - Argument* fwdref_211 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0_i_2 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.2", label_forbody6_i_2); - int32_j_0_reg2mem_0_i_2->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_2->addIncoming(const_int32_34, label_forbody6_i_1); - int32_j_0_reg2mem_0_i_2->addIncoming(fwdref_211, label_forbody6_i_2); - - Argument* fwdref_212 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i_2 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.2", label_forbody6_i_2); - packed_vec_0_reg2mem_0_i_2->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_2->addIncoming(packed_tmp48_i_1, label_forbody6_i_1); - packed_vec_0_reg2mem_0_i_2->addIncoming(fwdref_212, label_forbody6_i_2); - - std::vector ptr_arraydecay11_i_2_indices; - ptr_arraydecay11_i_2_indices.push_back(const_int32_37); - ptr_arraydecay11_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - ptr_arraydecay11_i_2_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay11_i_2 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_2_indices.begin(), ptr_arraydecay11_i_2_indices.end(), "arraydecay11.i.2", label_forbody6_i_2); - LoadInst* float_tmp13_i_2 = new LoadInst(ptr_arraydecay11_i_2, "tmp13.i.2", false, label_forbody6_i_2); - InsertElementInst* packed_tmp15_i_2 = new InsertElementInst(packed_vec_0_reg2mem_0_i_2, float_tmp13_i_2, const_int32_34, "tmp15.i.2", label_forbody6_i_2); - std::vector ptr_arrayidx23_i_2_indices; - ptr_arrayidx23_i_2_indices.push_back(const_int32_37); - ptr_arrayidx23_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - ptr_arrayidx23_i_2_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx23_i_2 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_2_indices.begin(), ptr_arrayidx23_i_2_indices.end(), "arrayidx23.i.2", label_forbody6_i_2); - LoadInst* float_tmp24_i_2 = new LoadInst(ptr_arrayidx23_i_2, "tmp24.i.2", false, label_forbody6_i_2); - InsertElementInst* packed_tmp26_i_2 = new InsertElementInst(packed_tmp15_i_2, float_tmp24_i_2, const_int32_36, "tmp26.i.2", label_forbody6_i_2); - std::vector ptr_arrayidx34_i_2_indices; - ptr_arrayidx34_i_2_indices.push_back(const_int32_37); - ptr_arrayidx34_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - ptr_arrayidx34_i_2_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx34_i_2 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_2_indices.begin(), ptr_arrayidx34_i_2_indices.end(), "arrayidx34.i.2", label_forbody6_i_2); - LoadInst* float_tmp35_i_2 = new LoadInst(ptr_arrayidx34_i_2, "tmp35.i.2", false, label_forbody6_i_2); - InsertElementInst* packed_tmp37_i_2 = new InsertElementInst(packed_tmp26_i_2, float_tmp35_i_2, const_int32_37, "tmp37.i.2", label_forbody6_i_2); - std::vector ptr_arrayidx45_i_2_indices; - ptr_arrayidx45_i_2_indices.push_back(const_int32_37); - ptr_arrayidx45_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - ptr_arrayidx45_i_2_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx45_i_2 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_2_indices.begin(), ptr_arrayidx45_i_2_indices.end(), "arrayidx45.i.2", label_forbody6_i_2); - LoadInst* float_tmp46_i_2 = new LoadInst(ptr_arrayidx45_i_2, "tmp46.i.2", false, label_forbody6_i_2); - InsertElementInst* packed_tmp48_i_2 = new InsertElementInst(packed_tmp37_i_2, float_tmp46_i_2, const_int32_38, "tmp48.i.2", label_forbody6_i_2); - std::vector ptr_arrayidx54_i_2_indices; - ptr_arrayidx54_i_2_indices.push_back(const_int32_34); - ptr_arrayidx54_i_2_indices.push_back(const_int32_37); - ptr_arrayidx54_i_2_indices.push_back(int32_j_0_reg2mem_0_i_2); - Instruction* ptr_arrayidx54_i_2 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_2_indices.begin(), ptr_arrayidx54_i_2_indices.end(), "arrayidx54.i.2", label_forbody6_i_2); - StoreInst* void_213 = new StoreInst(packed_tmp48_i_2, ptr_arrayidx54_i_2, false, label_forbody6_i_2); - BinaryOperator* int32_inc_i_2 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_2, const_int32_36, "inc.i.2", label_forbody6_i_2); - ICmpInst* int1_cmp59_i_2 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_2, int32_num_inputs_131, "cmp59.i.2", label_forbody6_i_2); - new BranchInst(label_forbody6_i_2, label_forbody6_i_3, int1_cmp59_i_2, label_forbody6_i_2); - - // Block forbody6.i.3 (label_forbody6_i_3) - Argument* fwdref_215 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0_i_3 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0.i.3", label_forbody6_i_3); - int32_j_0_reg2mem_0_i_3->reserveOperandSpace(2); - int32_j_0_reg2mem_0_i_3->addIncoming(const_int32_34, label_forbody6_i_2); - int32_j_0_reg2mem_0_i_3->addIncoming(fwdref_215, label_forbody6_i_3); - - Argument* fwdref_216 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i_3 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i.3", label_forbody6_i_3); - packed_vec_0_reg2mem_0_i_3->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_3->addIncoming(packed_tmp48_i_2, label_forbody6_i_2); - packed_vec_0_reg2mem_0_i_3->addIncoming(fwdref_216, label_forbody6_i_3); - - std::vector ptr_arraydecay11_i_3_indices; - ptr_arraydecay11_i_3_indices.push_back(const_int32_38); - ptr_arraydecay11_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - ptr_arraydecay11_i_3_indices.push_back(const_int32_34); - Instruction* ptr_arraydecay11_i_3 = new GetElementPtrInst(ptr_ainputs_130, ptr_arraydecay11_i_3_indices.begin(), ptr_arraydecay11_i_3_indices.end(), "arraydecay11.i.3", label_forbody6_i_3); - LoadInst* float_tmp13_i_3 = new LoadInst(ptr_arraydecay11_i_3, "tmp13.i.3", false, label_forbody6_i_3); - InsertElementInst* packed_tmp15_i_3 = new InsertElementInst(packed_vec_0_reg2mem_0_i_3, float_tmp13_i_3, const_int32_34, "tmp15.i.3", label_forbody6_i_3); - std::vector ptr_arrayidx23_i_3_indices; - ptr_arrayidx23_i_3_indices.push_back(const_int32_38); - ptr_arrayidx23_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - ptr_arrayidx23_i_3_indices.push_back(const_int32_36); - Instruction* ptr_arrayidx23_i_3 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx23_i_3_indices.begin(), ptr_arrayidx23_i_3_indices.end(), "arrayidx23.i.3", label_forbody6_i_3); - LoadInst* float_tmp24_i_3 = new LoadInst(ptr_arrayidx23_i_3, "tmp24.i.3", false, label_forbody6_i_3); - InsertElementInst* packed_tmp26_i_3 = new InsertElementInst(packed_tmp15_i_3, float_tmp24_i_3, const_int32_36, "tmp26.i.3", label_forbody6_i_3); - std::vector ptr_arrayidx34_i_3_indices; - ptr_arrayidx34_i_3_indices.push_back(const_int32_38); - ptr_arrayidx34_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - ptr_arrayidx34_i_3_indices.push_back(const_int32_37); - Instruction* ptr_arrayidx34_i_3 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx34_i_3_indices.begin(), ptr_arrayidx34_i_3_indices.end(), "arrayidx34.i.3", label_forbody6_i_3); - LoadInst* float_tmp35_i_3 = new LoadInst(ptr_arrayidx34_i_3, "tmp35.i.3", false, label_forbody6_i_3); - InsertElementInst* packed_tmp37_i_3 = new InsertElementInst(packed_tmp26_i_3, float_tmp35_i_3, const_int32_37, "tmp37.i.3", label_forbody6_i_3); - std::vector ptr_arrayidx45_i_3_indices; - ptr_arrayidx45_i_3_indices.push_back(const_int32_38); - ptr_arrayidx45_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - ptr_arrayidx45_i_3_indices.push_back(const_int32_38); - Instruction* ptr_arrayidx45_i_3 = new GetElementPtrInst(ptr_ainputs_130, ptr_arrayidx45_i_3_indices.begin(), ptr_arrayidx45_i_3_indices.end(), "arrayidx45.i.3", label_forbody6_i_3); - LoadInst* float_tmp46_i_3 = new LoadInst(ptr_arrayidx45_i_3, "tmp46.i.3", false, label_forbody6_i_3); - InsertElementInst* packed_tmp48_i_3 = new InsertElementInst(packed_tmp37_i_3, float_tmp46_i_3, const_int32_38, "tmp48.i.3", label_forbody6_i_3); - std::vector ptr_arrayidx54_i_3_indices; - ptr_arrayidx54_i_3_indices.push_back(const_int32_34); - ptr_arrayidx54_i_3_indices.push_back(const_int32_38); - ptr_arrayidx54_i_3_indices.push_back(int32_j_0_reg2mem_0_i_3); - Instruction* ptr_arrayidx54_i_3 = new GetElementPtrInst(ptr_inputs_140, ptr_arrayidx54_i_3_indices.begin(), ptr_arrayidx54_i_3_indices.end(), "arrayidx54.i.3", label_forbody6_i_3); - StoreInst* void_217 = new StoreInst(packed_tmp48_i_3, ptr_arrayidx54_i_3, false, label_forbody6_i_3); - BinaryOperator* int32_inc_i_3 = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0_i_3, const_int32_36, "inc.i.3", label_forbody6_i_3); - ICmpInst* int1_cmp59_i_3 = new ICmpInst(ICmpInst::ICMP_SLT, int32_inc_i_3, int32_num_inputs_131, "cmp59.i.3", label_forbody6_i_3); - new BranchInst(label_forbody6_i_3, label_from_array_exit_136, int1_cmp59_i_3, label_forbody6_i_3); + ptr_tmp_indices.push_back(const_int32_30); + ptr_tmp_indices.push_back(const_int32_35); + Instruction* ptr_tmp = new GetElementPtrInst(ptr_args_114, ptr_tmp_indices.begin(), ptr_tmp_indices.end(), "tmp", label_entry_109); + StoreInst* void_115 = new StoreInst(const_int32_30, ptr_tmp, false, label_entry_109); + ICmpInst* int1_cmp_i_116 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_108, const_int32_30, "cmp.i", label_entry_109); + new BranchInst(label_forbody_i_110, label_from_consts_exit_111, int1_cmp_i_116, label_entry_109); + + // Block forbody.i (label_forbody_i_110) + Argument* fwdref_119 = new Argument(IntegerType::get(32)); + PHINode* int32_i_0_reg2mem_0_i_118 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i", label_forbody_i_110); + int32_i_0_reg2mem_0_i_118->reserveOperandSpace(2); + int32_i_0_reg2mem_0_i_118->addIncoming(const_int32_30, label_entry_109); + int32_i_0_reg2mem_0_i_118->addIncoming(fwdref_119, label_forbody_i_110); + + Argument* fwdref_121 = new Argument(VectorTy_1); + PHINode* packed_vec_0_reg2mem_0_i_120 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody_i_110); + packed_vec_0_reg2mem_0_i_120->reserveOperandSpace(2); + packed_vec_0_reg2mem_0_i_120->addIncoming(const_packed_31, label_entry_109); + packed_vec_0_reg2mem_0_i_120->addIncoming(fwdref_121, label_forbody_i_110); + + std::vector ptr_arraydecay_i_122_indices; + ptr_arraydecay_i_122_indices.push_back(int32_i_0_reg2mem_0_i_118); + ptr_arraydecay_i_122_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay_i_122 = new GetElementPtrInst(ptr_aconsts_107, ptr_arraydecay_i_122_indices.begin(), ptr_arraydecay_i_122_indices.end(), "arraydecay.i", label_forbody_i_110); + LoadInst* float_tmp5_i_123 = new LoadInst(ptr_arraydecay_i_122, "tmp5.i", false, label_forbody_i_110); + InsertElementInst* packed_tmp7_i_124 = new InsertElementInst(packed_vec_0_reg2mem_0_i_120, float_tmp5_i_123, const_int32_30, "tmp7.i", label_forbody_i_110); + std::vector ptr_arrayidx12_i_125_indices; + ptr_arrayidx12_i_125_indices.push_back(int32_i_0_reg2mem_0_i_118); + ptr_arrayidx12_i_125_indices.push_back(const_int32_32); + Instruction* ptr_arrayidx12_i_125 = new GetElementPtrInst(ptr_aconsts_107, ptr_arrayidx12_i_125_indices.begin(), ptr_arrayidx12_i_125_indices.end(), "arrayidx12.i", label_forbody_i_110); + LoadInst* float_tmp13_i_126 = new LoadInst(ptr_arrayidx12_i_125, "tmp13.i", false, label_forbody_i_110); + InsertElementInst* packed_tmp15_i_127 = new InsertElementInst(packed_tmp7_i_124, float_tmp13_i_126, const_int32_32, "tmp15.i", label_forbody_i_110); + std::vector ptr_arrayidx20_i_128_indices; + ptr_arrayidx20_i_128_indices.push_back(int32_i_0_reg2mem_0_i_118); + ptr_arrayidx20_i_128_indices.push_back(const_int32_33); + Instruction* ptr_arrayidx20_i_128 = new GetElementPtrInst(ptr_aconsts_107, ptr_arrayidx20_i_128_indices.begin(), ptr_arrayidx20_i_128_indices.end(), "arrayidx20.i", label_forbody_i_110); + LoadInst* float_tmp21_i_129 = new LoadInst(ptr_arrayidx20_i_128, "tmp21.i", false, label_forbody_i_110); + InsertElementInst* packed_tmp23_i_130 = new InsertElementInst(packed_tmp15_i_127, float_tmp21_i_129, const_int32_33, "tmp23.i", label_forbody_i_110); + std::vector ptr_arrayidx28_i_131_indices; + ptr_arrayidx28_i_131_indices.push_back(int32_i_0_reg2mem_0_i_118); + ptr_arrayidx28_i_131_indices.push_back(const_int32_34); + Instruction* ptr_arrayidx28_i_131 = new GetElementPtrInst(ptr_aconsts_107, ptr_arrayidx28_i_131_indices.begin(), ptr_arrayidx28_i_131_indices.end(), "arrayidx28.i", label_forbody_i_110); + LoadInst* float_tmp29_i_132 = new LoadInst(ptr_arrayidx28_i_131, "tmp29.i", false, label_forbody_i_110); + InsertElementInst* packed_tmp31_i_133 = new InsertElementInst(packed_tmp23_i_130, float_tmp29_i_132, const_int32_34, "tmp31.i", label_forbody_i_110); + std::vector ptr_arrayidx34_i_134_indices; + ptr_arrayidx34_i_134_indices.push_back(const_int32_30); + ptr_arrayidx34_i_134_indices.push_back(int32_i_0_reg2mem_0_i_118); + Instruction* ptr_arrayidx34_i_134 = new GetElementPtrInst(ptr_consts_112, ptr_arrayidx34_i_134_indices.begin(), ptr_arrayidx34_i_134_indices.end(), "arrayidx34.i", label_forbody_i_110); + StoreInst* void_135 = new StoreInst(packed_tmp31_i_133, ptr_arrayidx34_i_134, false, label_forbody_i_110); + BinaryOperator* int32_indvar_next7 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i_118, const_int32_32, "indvar.next7", label_forbody_i_110); + ICmpInst* int1_exitcond8 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next7, int32_num_consts_108, "exitcond8", label_forbody_i_110); + new BranchInst(label_from_consts_exit_111, label_forbody_i_110, int1_exitcond8, label_forbody_i_110); + + // Block from_consts.exit (label_from_consts_exit_111) + std::vector ptr_tmp3_indices; + ptr_tmp3_indices.push_back(const_int32_30); + ptr_tmp3_indices.push_back(const_int32_34); + Instruction* ptr_tmp3 = new GetElementPtrInst(ptr_args_114, ptr_tmp3_indices.begin(), ptr_tmp3_indices.end(), "tmp3", label_from_consts_exit_111); + std::vector ptr_arraydecay4_indices; + ptr_arraydecay4_indices.push_back(const_int32_30); + ptr_arraydecay4_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay4 = new GetElementPtrInst(ptr_consts_112, ptr_arraydecay4_indices.begin(), ptr_arraydecay4_indices.end(), "arraydecay4", label_from_consts_exit_111); + StoreInst* void_137 = new StoreInst(ptr_arraydecay4, ptr_tmp3, false, label_from_consts_exit_111); + std::vector ptr_tmp5_indices; + ptr_tmp5_indices.push_back(const_int32_30); + ptr_tmp5_indices.push_back(const_int32_33); + Instruction* ptr_tmp5 = new GetElementPtrInst(ptr_args_114, ptr_tmp5_indices.begin(), ptr_tmp5_indices.end(), "tmp5", label_from_consts_exit_111); + std::vector ptr_arraydecay6_indices; + ptr_arraydecay6_indices.push_back(const_int32_30); + ptr_arraydecay6_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay6 = new GetElementPtrInst(ptr_temps_113, ptr_arraydecay6_indices.begin(), ptr_arraydecay6_indices.end(), "arraydecay6", label_from_consts_exit_111); + StoreInst* void_138 = new StoreInst(ptr_arraydecay6, ptr_tmp5, false, label_from_consts_exit_111); + std::vector ptr_tmp8_139_indices; + ptr_tmp8_139_indices.push_back(const_int32_30); + ptr_tmp8_139_indices.push_back(const_int32_32); + Instruction* ptr_tmp8_139 = new GetElementPtrInst(ptr_args_114, ptr_tmp8_139_indices.begin(), ptr_tmp8_139_indices.end(), "tmp8", label_from_consts_exit_111); + std::vector ptr_tmp12_140_indices; + ptr_tmp12_140_indices.push_back(const_int32_30); + ptr_tmp12_140_indices.push_back(const_int32_30); + Instruction* ptr_tmp12_140 = new GetElementPtrInst(ptr_args_114, ptr_tmp12_140_indices.begin(), ptr_tmp12_140_indices.end(), "tmp12", label_from_consts_exit_111); + std::vector ptr_arraydecay11_141_indices; + ptr_arraydecay11_141_indices.push_back(const_int32_30); + ptr_arraydecay11_141_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay11_141 = new GetElementPtrInst(ptr_inputs_105, ptr_arraydecay11_141_indices.begin(), ptr_arraydecay11_141_indices.end(), "arraydecay11", label_from_consts_exit_111); + StoreInst* void_142 = new StoreInst(ptr_arraydecay11_141, ptr_tmp8_139, false, label_from_consts_exit_111); + std::vector ptr_arraydecay16_143_indices; + ptr_arraydecay16_143_indices.push_back(const_int32_30); + ptr_arraydecay16_143_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay16_143 = new GetElementPtrInst(ptr_results_104, ptr_arraydecay16_143_indices.begin(), ptr_arraydecay16_143_indices.end(), "arraydecay16", label_from_consts_exit_111); + StoreInst* void_144 = new StoreInst(ptr_arraydecay16_143, ptr_tmp12_140, false, label_from_consts_exit_111); + StoreInst* void_145 = new StoreInst(const_int32_30, ptr_tmp, false, label_from_consts_exit_111); + CallInst* void_146 = new CallInst(func_execute_shader, ptr_args_114, "", label_from_consts_exit_111); + void_146->setCallingConv(CallingConv::C); + void_146->setTailCall(false); + LoadInst* int32_tmp23 = new LoadInst(ptr_tmp, "tmp23", false, label_from_consts_exit_111); + std::vector ptr_arraydecay11_1_indices; + ptr_arraydecay11_1_indices.push_back(const_int32_32); + ptr_arraydecay11_1_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay11_1 = new GetElementPtrInst(ptr_inputs_105, ptr_arraydecay11_1_indices.begin(), ptr_arraydecay11_1_indices.end(), "arraydecay11.1", label_from_consts_exit_111); + StoreInst* void_147 = new StoreInst(ptr_arraydecay11_1, ptr_tmp8_139, false, label_from_consts_exit_111); + std::vector ptr_arraydecay16_1_indices; + ptr_arraydecay16_1_indices.push_back(const_int32_32); + ptr_arraydecay16_1_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay16_1 = new GetElementPtrInst(ptr_results_104, ptr_arraydecay16_1_indices.begin(), ptr_arraydecay16_1_indices.end(), "arraydecay16.1", label_from_consts_exit_111); + StoreInst* void_148 = new StoreInst(ptr_arraydecay16_1, ptr_tmp12_140, false, label_from_consts_exit_111); + StoreInst* void_149 = new StoreInst(const_int32_30, ptr_tmp, false, label_from_consts_exit_111); + CallInst* void_150 = new CallInst(func_execute_shader, ptr_args_114, "", label_from_consts_exit_111); + void_150->setCallingConv(CallingConv::C); + void_150->setTailCall(false); + LoadInst* int32_tmp23_1 = new LoadInst(ptr_tmp, "tmp23.1", false, label_from_consts_exit_111); + BinaryOperator* int32_shl_1 = BinaryOperator::create(Instruction::Shl, int32_tmp23_1, const_int32_32, "shl.1", label_from_consts_exit_111); + BinaryOperator* int32_or_1 = BinaryOperator::create(Instruction::Or, int32_shl_1, int32_tmp23, "or.1", label_from_consts_exit_111); + std::vector ptr_arraydecay11_2_indices; + ptr_arraydecay11_2_indices.push_back(const_int32_33); + ptr_arraydecay11_2_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay11_2 = new GetElementPtrInst(ptr_inputs_105, ptr_arraydecay11_2_indices.begin(), ptr_arraydecay11_2_indices.end(), "arraydecay11.2", label_from_consts_exit_111); + StoreInst* void_151 = new StoreInst(ptr_arraydecay11_2, ptr_tmp8_139, false, label_from_consts_exit_111); + std::vector ptr_arraydecay16_2_indices; + ptr_arraydecay16_2_indices.push_back(const_int32_33); + ptr_arraydecay16_2_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay16_2 = new GetElementPtrInst(ptr_results_104, ptr_arraydecay16_2_indices.begin(), ptr_arraydecay16_2_indices.end(), "arraydecay16.2", label_from_consts_exit_111); + StoreInst* void_152 = new StoreInst(ptr_arraydecay16_2, ptr_tmp12_140, false, label_from_consts_exit_111); + StoreInst* void_153 = new StoreInst(const_int32_30, ptr_tmp, false, label_from_consts_exit_111); + CallInst* void_154 = new CallInst(func_execute_shader, ptr_args_114, "", label_from_consts_exit_111); + void_154->setCallingConv(CallingConv::C); + void_154->setTailCall(false); + LoadInst* int32_tmp23_2 = new LoadInst(ptr_tmp, "tmp23.2", false, label_from_consts_exit_111); + BinaryOperator* int32_shl_2 = BinaryOperator::create(Instruction::Shl, int32_tmp23_2, const_int32_33, "shl.2", label_from_consts_exit_111); + BinaryOperator* int32_or_2 = BinaryOperator::create(Instruction::Or, int32_shl_2, int32_or_1, "or.2", label_from_consts_exit_111); + std::vector ptr_arraydecay11_3_indices; + ptr_arraydecay11_3_indices.push_back(const_int32_34); + ptr_arraydecay11_3_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay11_3 = new GetElementPtrInst(ptr_inputs_105, ptr_arraydecay11_3_indices.begin(), ptr_arraydecay11_3_indices.end(), "arraydecay11.3", label_from_consts_exit_111); + StoreInst* void_155 = new StoreInst(ptr_arraydecay11_3, ptr_tmp8_139, false, label_from_consts_exit_111); + std::vector ptr_arraydecay16_3_indices; + ptr_arraydecay16_3_indices.push_back(const_int32_34); + ptr_arraydecay16_3_indices.push_back(const_int32_30); + Instruction* ptr_arraydecay16_3 = new GetElementPtrInst(ptr_results_104, ptr_arraydecay16_3_indices.begin(), ptr_arraydecay16_3_indices.end(), "arraydecay16.3", label_from_consts_exit_111); + StoreInst* void_156 = new StoreInst(ptr_arraydecay16_3, ptr_tmp12_140, false, label_from_consts_exit_111); + StoreInst* void_157 = new StoreInst(const_int32_30, ptr_tmp, false, label_from_consts_exit_111); + CallInst* void_158 = new CallInst(func_execute_shader, ptr_args_114, "", label_from_consts_exit_111); + void_158->setCallingConv(CallingConv::C); + void_158->setTailCall(false); + LoadInst* int32_tmp23_3 = new LoadInst(ptr_tmp, "tmp23.3", false, label_from_consts_exit_111); + BinaryOperator* int32_shl_3 = BinaryOperator::create(Instruction::Shl, int32_tmp23_3, const_int32_34, "shl.3", label_from_consts_exit_111); + BinaryOperator* int32_or_3 = BinaryOperator::create(Instruction::Or, int32_shl_3, int32_or_2, "or.3", label_from_consts_exit_111); + BinaryOperator* int32_neg = BinaryOperator::create(Instruction::Xor, int32_or_3, const_int32_36, "neg", label_from_consts_exit_111); + new ReturnInst(int32_neg, label_from_consts_exit_111); // Resolve Forward References - fwdref_216->replaceAllUsesWith(packed_tmp48_i_3); delete fwdref_216; - fwdref_215->replaceAllUsesWith(int32_inc_i_3); delete fwdref_215; - fwdref_151->replaceAllUsesWith(packed_tmp48_i_163); delete fwdref_151; - fwdref_149->replaceAllUsesWith(int32_inc_i_166); delete fwdref_149; - fwdref_172->replaceAllUsesWith(packed_tmp31_i_179); delete fwdref_172; - fwdref_171->replaceAllUsesWith(int32_indvar_next23); delete fwdref_171; - fwdref_189->replaceAllUsesWith(int32_or); delete fwdref_189; - fwdref_191->replaceAllUsesWith(int32_indvar_next21); delete fwdref_191; - fwdref_208->replaceAllUsesWith(packed_tmp48_i_1); delete fwdref_208; - fwdref_207->replaceAllUsesWith(int32_inc_i_1); delete fwdref_207; - fwdref_212->replaceAllUsesWith(packed_tmp48_i_2); delete fwdref_212; - fwdref_211->replaceAllUsesWith(int32_inc_i_2); delete fwdref_211; + fwdref_121->replaceAllUsesWith(packed_tmp31_i_133); delete fwdref_121; + fwdref_119->replaceAllUsesWith(int32_indvar_next7); delete fwdref_119; } diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c index 03f7ac8f14..909bef340a 100644 --- a/src/mesa/pipe/llvm/llvm_entry.c +++ b/src/mesa/pipe/llvm/llvm_entry.c @@ -68,6 +68,7 @@ compute_clipmask(float4 clip, float4 (*plane), unsigned nr) return mask; } + inline void collect_results(float4 *results, struct vertex_header *vOut, float4 *planes, int nr_planes, float4 scale, float4 trans, @@ -76,7 +77,6 @@ inline void collect_results(float4 *results, struct vertex_header *vOut, /* store results */ unsigned slot; float x, y, z, w; - /* Handle attr[0] (position) specially: */ float4 res0 = results[0]; @@ -85,7 +85,6 @@ inline void collect_results(float4 *results, struct vertex_header *vOut, y = clip[1] = res0.y; z = clip[2] = res0.z; w = clip[3] = res0.w; - vOut->clipmask = compute_clipmask(res0, planes, nr_planes); vOut->edgeflag = 1; @@ -176,23 +175,20 @@ struct ShaderInput extern void execute_shader(struct ShaderInput *input); -void run_vertex_shader(float (*ainputs)[16][4], - float (*dests)[16][4], +void run_vertex_shader(float4 (*inputs)[16], + float4 (*results)[16], float (*aconsts)[4], int num_vertices, int num_inputs, int num_attribs, int num_consts) { - float4 inputs[16*32*4][16]; float4 consts[32]; - float4 results[16*32*4][16]; float4 temps[128];//MAX_PROGRAM_TEMPS struct ShaderInput args; /*printf("XXX LLVM run_vertex_shader vertices = %d, inputs = %d, attribs = %d, consts = %d\n", num_vertices, num_inputs, num_attribs, num_consts);*/ - from_array(inputs, ainputs, num_vertices, num_inputs); from_consts(consts, aconsts, num_consts); args.consts = consts; args.temps = temps; @@ -200,7 +196,6 @@ void run_vertex_shader(float (*ainputs)[16][4], args.dests = results[i]; args.inputs = inputs[i]; execute_shader(&args); - to_array(dests[i], args.dests, num_attribs); } } @@ -227,22 +222,19 @@ struct tgsi_sampler int run_fragment_shader(float x, float y, - float (*dests)[16][4], - float (*ainputs)[16][4], + float4 (*results)[16], + float4 (*inputs)[16], int num_inputs, float (*aconsts)[4], int num_consts, struct tgsi_sampler *samplers) { - float4 inputs[4][16]; float4 consts[32]; - float4 results[4][16]; float4 temps[128];//MAX_PROGRAM_TEMPS struct ShaderInput args; int mask = 0; args.kilmask = 0; - from_array(inputs, ainputs, 4, num_inputs); from_consts(consts, aconsts, num_consts); args.consts = consts; args.temps = temps; @@ -254,8 +246,6 @@ int run_fragment_shader(float x, float y, args.kilmask = 0; execute_shader(&args); args.kilmask = mask | (args.kilmask << i); - - to_array(dests[i], args.dests, 2); } return ~args.kilmask; } diff --git a/src/mesa/pipe/p_compiler.h b/src/mesa/pipe/p_compiler.h index 020977b05b..4f2c9ef88a 100644 --- a/src/mesa/pipe/p_compiler.h +++ b/src/mesa/pipe/p_compiler.h @@ -73,9 +73,11 @@ typedef unsigned long long uint64; #if defined __GNUC__ #define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___aligned[SIZE] __attribute__(( aligned( 16 ) )) #define ALIGN16_ASSIGN(NAME) NAME##___aligned +#define ALIGN16_ATTRIB __attribute__(( aligned( 16 ) )) #else #define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___unaligned[SIZE + 1] #define ALIGN16_ASSIGN(NAME) align16(NAME##___unaligned) +#define ALIGN16_ATTRIB #endif diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 5ea07f95a4..251b47341a 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -173,12 +173,11 @@ shade_quad_llvm(struct quad_stage *qs, { struct quad_shade_stage *qss = quad_shade_stage(qs); struct softpipe_context *softpipe = qs->softpipe; - float dests[4][16][4]; + float dests[4][16][4] ALIGN16_ATTRIB; + float inputs[4][16][4] ALIGN16_ATTRIB; const float fx = (float) quad->x0; const float fy = (float) quad->y0; struct gallivm_prog *llvm = qss->llvm_prog; - float inputs[4][16][4]; - memset(inputs, 0, sizeof(inputs)); inputs[0][0][0] = fx; inputs[1][0][0] = fx + 1.0f; -- cgit v1.2.3