From 4299650b255cbe573d37cbf74ae375b17f9e12cb Mon Sep 17 00:00:00 2001 From: Prakalp Srivastava <psrivas2@illinois.edu> Date: Sat, 29 Nov 2014 00:56:07 +0000 Subject: [PATCH] Unedited version of mri-q.ll --- .../benchmarks/mri-q/src/visc/visc_mri-q.ll | 1699 +++++++++++------ 1 file changed, 1084 insertions(+), 615 deletions(-) diff --git a/llvm/test/VISC/parboil/benchmarks/mri-q/src/visc/visc_mri-q.ll b/llvm/test/VISC/parboil/benchmarks/mri-q/src/visc/visc_mri-q.ll index 0f56a342f1..e968340bd8 100644 --- a/llvm/test/VISC/parboil/benchmarks/mri-q/src/visc/visc_mri-q.ll +++ b/llvm/test/VISC/parboil/benchmarks/mri-q/src/visc/visc_mri-q.ll @@ -1,3 +1,9 @@ +; RUN: opt -load LLVMBuildDFG.so -load LLVMDFG2LLVM_NVPTX.so -load LLVMDFG2LLVM_X86.so -load LLVMClearDFG.so -dfg2llvm-nvptx -dfg2llvm-x86 -clearDFG -o %t.ll -S %s +; RUN: llvm-link %llvm_src/../libclc/built_libs/nvptx--nvidiacl.bc %s.kernels.ll -o %t.ll.kernels.linked.bc +; RUN: clang -O3 -target nvptx %t.ll.kernels.linked.bc -S -o %s.nvptx.s +; RUN: llvm-link %t.ll %llvm_src/projects/visc-rt/visc-rt.ll -S -o %t.linked.ll +; RUN: clang++ -O3 %t.linked.ll -lpthread -lOpenCL -o %t.bin +; RUN: %t.bin ; ModuleID = 'main.c' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-redhat-linux-gnu" @@ -5,12 +11,16 @@ target triple = "x86_64-redhat-linux-gnu" %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] } %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } %struct.kValues = type { float, float, float, float } +%struct.pb_Parameters = type { i8*, i8** } %struct.pb_TimerSet = type { i32, %struct.pb_async_time_marker_list*, i64, i64, [8 x %struct.pb_Timer], [8 x %struct.pb_SubTimerList*] } %struct.pb_async_time_marker_list = type { i8*, i32, i8*, %struct.pb_async_time_marker_list* } %struct.pb_Timer = type { i32, i64, i64 } %struct.pb_SubTimerList = type { %struct.pb_SubTimer*, %struct.pb_SubTimer* } %struct.pb_SubTimer = type { i8*, %struct.pb_Timer, %struct.pb_SubTimer* } -%struct.pb_Parameters = type { i8*, i8** } + +@custom_str = private unnamed_addr constant [12 x i8] c"Value = %d\0A\00", align 1 +@hex_str = private unnamed_addr constant [14 x i8] c"Value = 0x%x\0A\00", align 1 +@ptr_str = private unnamed_addr constant [12 x i8] c"Value = %p\0A\00", align 1 @.str = private unnamed_addr constant [2 x i8] c"r\00", align 1 @stderr = external global %struct._IO_FILE* @@ -23,421 +33,693 @@ target triple = "x86_64-redhat-linux-gnu" @.str7 = private unnamed_addr constant [65 x i8] c"%d pixels in output; %d samples in trajectory; using %d samples\0A\00", align 1 ; Function Attrs: nounwind uwtable -define void @inputData(i8* nocapture readonly %fName, i32* nocapture %_numK, i32* nocapture %_numX, float** nocapture %kx, float** nocapture %ky, float** nocapture %kz, float** nocapture %x, float** nocapture %y, float** nocapture %z, float** nocapture %phiR, float** nocapture %phiI) #0 { +define void @inputData(i8* %fName, i32* %_numK, i32* %_numX, float** %kx, float** %ky, float** %kz, float** %x, float** %y, float** %z, float** %phiR, float** %phiI) #0 { + %1 = alloca i8*, align 8 + %2 = alloca i32*, align 8 + %3 = alloca i32*, align 8 + %4 = alloca float**, align 8 + %5 = alloca float**, align 8 + %6 = alloca float**, align 8 + %7 = alloca float**, align 8 + %8 = alloca float**, align 8 + %9 = alloca float**, align 8 + %10 = alloca float**, align 8 + %11 = alloca float**, align 8 %numK = alloca i32, align 4 %numX = alloca i32, align 4 - %1 = tail call %struct._IO_FILE* @fopen(i8* %fName, i8* getelementptr inbounds ([2 x i8]* @.str, i64 0, i64 0)) #6 - %2 = icmp eq %struct._IO_FILE* %1, null - br i1 %2, label %3, label %6 - -; <label>:3 ; preds = %0 - %4 = load %struct._IO_FILE** @stderr, align 8, !tbaa !1 - %5 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8]* @.str1, i64 0, i64 0), i64 23, i64 1, %struct._IO_FILE* %4) #7 - tail call void @exit(i32 -1) #8 + %fid = alloca %struct._IO_FILE*, align 8 + store i8* %fName, i8** %1, align 8 + store i32* %_numK, i32** %2, align 8 + store i32* %_numX, i32** %3, align 8 + store float** %kx, float*** %4, align 8 + store float** %ky, float*** %5, align 8 + store float** %kz, float*** %6, align 8 + store float** %x, float*** %7, align 8 + store float** %y, float*** %8, align 8 + store float** %z, float*** %9, align 8 + store float** %phiR, float*** %10, align 8 + store float** %phiI, float*** %11, align 8 + %12 = load i8** %1, align 8 + %13 = call %struct._IO_FILE* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8]* @.str, i32 0, i32 0)) + store %struct._IO_FILE* %13, %struct._IO_FILE** %fid, align 8 + %14 = load %struct._IO_FILE** %fid, align 8 + %15 = icmp eq %struct._IO_FILE* %14, null + br i1 %15, label %16, label %19 + +; <label>:16 ; preds = %0 + %17 = load %struct._IO_FILE** @stderr, align 8 + %18 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %17, i8* getelementptr inbounds ([24 x i8]* @.str1, i32 0, i32 0)) + call void @exit(i32 -1) #6 unreachable -; <label>:6 ; preds = %0 - %7 = bitcast i32* %numK to i8* - %8 = call i64 @fread(i8* %7, i64 4, i64 1, %struct._IO_FILE* %1) #6 - %9 = load i32* %numK, align 4, !tbaa !5 - store i32 %9, i32* %_numK, align 4, !tbaa !5 - %10 = bitcast i32* %numX to i8* - %11 = call i64 @fread(i8* %10, i64 4, i64 1, %struct._IO_FILE* %1) #6 - %12 = load i32* %numX, align 4, !tbaa !5 - store i32 %12, i32* %_numX, align 4, !tbaa !5 - %13 = sext i32 %9 to i64 - %14 = shl nsw i64 %13, 2 - %15 = tail call noalias i8* @memalign(i64 16, i64 %14) #6 - %16 = bitcast i8* %15 to float* - store float* %16, float** %kx, align 8, !tbaa !1 - %17 = tail call i64 @fread(i8* %15, i64 4, i64 %13, %struct._IO_FILE* %1) #6 - %18 = tail call noalias i8* @memalign(i64 16, i64 %14) #6 - %19 = bitcast i8* %18 to float* - store float* %19, float** %ky, align 8, !tbaa !1 - %20 = tail call i64 @fread(i8* %18, i64 4, i64 %13, %struct._IO_FILE* %1) #6 - %21 = tail call noalias i8* @memalign(i64 16, i64 %14) #6 - %22 = bitcast i8* %21 to float* - store float* %22, float** %kz, align 8, !tbaa !1 - %23 = tail call i64 @fread(i8* %21, i64 4, i64 %13, %struct._IO_FILE* %1) #6 - %24 = sext i32 %12 to i64 - %25 = shl nsw i64 %24, 2 - %26 = tail call noalias i8* @memalign(i64 16, i64 %25) #6 - %27 = bitcast i8* %26 to float* - store float* %27, float** %x, align 8, !tbaa !1 - %28 = tail call i64 @fread(i8* %26, i64 4, i64 %24, %struct._IO_FILE* %1) #6 - %29 = tail call noalias i8* @memalign(i64 16, i64 %25) #6 - %30 = bitcast i8* %29 to float* - store float* %30, float** %y, align 8, !tbaa !1 - %31 = tail call i64 @fread(i8* %29, i64 4, i64 %24, %struct._IO_FILE* %1) #6 - %32 = tail call noalias i8* @memalign(i64 16, i64 %25) #6 - %33 = bitcast i8* %32 to float* - store float* %33, float** %z, align 8, !tbaa !1 - %34 = tail call i64 @fread(i8* %32, i64 4, i64 %24, %struct._IO_FILE* %1) #6 - %35 = tail call noalias i8* @memalign(i64 16, i64 %14) #6 - %36 = bitcast i8* %35 to float* - store float* %36, float** %phiR, align 8, !tbaa !1 - %37 = tail call i64 @fread(i8* %35, i64 4, i64 %13, %struct._IO_FILE* %1) #6 - %38 = tail call noalias i8* @memalign(i64 16, i64 %14) #6 - %39 = bitcast i8* %38 to float* - store float* %39, float** %phiI, align 8, !tbaa !1 - %40 = tail call i64 @fread(i8* %38, i64 4, i64 %13, %struct._IO_FILE* %1) #6 - %41 = tail call i32 @fclose(%struct._IO_FILE* %1) #6 +; <label>:19 ; preds = %0 + %20 = bitcast i32* %numK to i8* + %21 = load %struct._IO_FILE** %fid, align 8 + %22 = call i64 @fread(i8* %20, i64 4, i64 1, %struct._IO_FILE* %21) + %23 = load i32* %numK, align 4 + %24 = load i32** %2, align 8 + store i32 %23, i32* %24, align 4 + %25 = bitcast i32* %numX to i8* + %26 = load %struct._IO_FILE** %fid, align 8 + %27 = call i64 @fread(i8* %25, i64 4, i64 1, %struct._IO_FILE* %26) + %28 = load i32* %numX, align 4 + %29 = load i32** %3, align 8 + store i32 %28, i32* %29, align 4 + %30 = load i32* %numK, align 4 + %31 = sext i32 %30 to i64 + %32 = mul i64 %31, 4 + %33 = call noalias i8* @memalign(i64 16, i64 %32) #7 + %34 = bitcast i8* %33 to float* + %35 = load float*** %4, align 8 + store float* %34, float** %35, align 8 + %36 = load float*** %4, align 8 + %37 = load float** %36, align 8 + %38 = bitcast float* %37 to i8* + %39 = load i32* %numK, align 4 + %40 = sext i32 %39 to i64 + %41 = load %struct._IO_FILE** %fid, align 8 + %42 = call i64 @fread(i8* %38, i64 4, i64 %40, %struct._IO_FILE* %41) + %43 = load i32* %numK, align 4 + %44 = sext i32 %43 to i64 + %45 = mul i64 %44, 4 + %46 = call noalias i8* @memalign(i64 16, i64 %45) #7 + %47 = bitcast i8* %46 to float* + %48 = load float*** %5, align 8 + store float* %47, float** %48, align 8 + %49 = load float*** %5, align 8 + %50 = load float** %49, align 8 + %51 = bitcast float* %50 to i8* + %52 = load i32* %numK, align 4 + %53 = sext i32 %52 to i64 + %54 = load %struct._IO_FILE** %fid, align 8 + %55 = call i64 @fread(i8* %51, i64 4, i64 %53, %struct._IO_FILE* %54) + %56 = load i32* %numK, align 4 + %57 = sext i32 %56 to i64 + %58 = mul i64 %57, 4 + %59 = call noalias i8* @memalign(i64 16, i64 %58) #7 + %60 = bitcast i8* %59 to float* + %61 = load float*** %6, align 8 + store float* %60, float** %61, align 8 + %62 = load float*** %6, align 8 + %63 = load float** %62, align 8 + %64 = bitcast float* %63 to i8* + %65 = load i32* %numK, align 4 + %66 = sext i32 %65 to i64 + %67 = load %struct._IO_FILE** %fid, align 8 + %68 = call i64 @fread(i8* %64, i64 4, i64 %66, %struct._IO_FILE* %67) + %69 = load i32* %numX, align 4 + %70 = sext i32 %69 to i64 + %71 = mul i64 %70, 4 + %72 = call noalias i8* @memalign(i64 16, i64 %71) #7 + %73 = bitcast i8* %72 to float* + %74 = load float*** %7, align 8 + store float* %73, float** %74, align 8 + %75 = load float*** %7, align 8 + %76 = load float** %75, align 8 + %77 = bitcast float* %76 to i8* + %78 = load i32* %numX, align 4 + %79 = sext i32 %78 to i64 + %80 = load %struct._IO_FILE** %fid, align 8 + %81 = call i64 @fread(i8* %77, i64 4, i64 %79, %struct._IO_FILE* %80) + %82 = load i32* %numX, align 4 + %83 = sext i32 %82 to i64 + %84 = mul i64 %83, 4 + %85 = call noalias i8* @memalign(i64 16, i64 %84) #7 + %86 = bitcast i8* %85 to float* + %87 = load float*** %8, align 8 + store float* %86, float** %87, align 8 + %88 = load float*** %8, align 8 + %89 = load float** %88, align 8 + %90 = bitcast float* %89 to i8* + %91 = load i32* %numX, align 4 + %92 = sext i32 %91 to i64 + %93 = load %struct._IO_FILE** %fid, align 8 + %94 = call i64 @fread(i8* %90, i64 4, i64 %92, %struct._IO_FILE* %93) + %95 = load i32* %numX, align 4 + %96 = sext i32 %95 to i64 + %97 = mul i64 %96, 4 + %98 = call noalias i8* @memalign(i64 16, i64 %97) #7 + %99 = bitcast i8* %98 to float* + %100 = load float*** %9, align 8 + store float* %99, float** %100, align 8 + %101 = load float*** %9, align 8 + %102 = load float** %101, align 8 + %103 = bitcast float* %102 to i8* + %104 = load i32* %numX, align 4 + %105 = sext i32 %104 to i64 + %106 = load %struct._IO_FILE** %fid, align 8 + %107 = call i64 @fread(i8* %103, i64 4, i64 %105, %struct._IO_FILE* %106) + %108 = load i32* %numK, align 4 + %109 = sext i32 %108 to i64 + %110 = mul i64 %109, 4 + %111 = call noalias i8* @memalign(i64 16, i64 %110) #7 + %112 = bitcast i8* %111 to float* + %113 = load float*** %10, align 8 + store float* %112, float** %113, align 8 + %114 = load float*** %10, align 8 + %115 = load float** %114, align 8 + %116 = bitcast float* %115 to i8* + %117 = load i32* %numK, align 4 + %118 = sext i32 %117 to i64 + %119 = load %struct._IO_FILE** %fid, align 8 + %120 = call i64 @fread(i8* %116, i64 4, i64 %118, %struct._IO_FILE* %119) + %121 = load i32* %numK, align 4 + %122 = sext i32 %121 to i64 + %123 = mul i64 %122, 4 + %124 = call noalias i8* @memalign(i64 16, i64 %123) #7 + %125 = bitcast i8* %124 to float* + %126 = load float*** %11, align 8 + store float* %125, float** %126, align 8 + %127 = load float*** %11, align 8 + %128 = load float** %127, align 8 + %129 = bitcast float* %128 to i8* + %130 = load i32* %numK, align 4 + %131 = sext i32 %130 to i64 + %132 = load %struct._IO_FILE** %fid, align 8 + %133 = call i64 @fread(i8* %129, i64 4, i64 %131, %struct._IO_FILE* %132) + %134 = load %struct._IO_FILE** %fid, align 8 + %135 = call i32 @fclose(%struct._IO_FILE* %134) ret void } -; Function Attrs: nounwind -declare noalias %struct._IO_FILE* @fopen(i8* nocapture readonly, i8* nocapture readonly) #1 +declare %struct._IO_FILE* @fopen(i8*, i8*) #1 + +declare i32 @fprintf(%struct._IO_FILE*, i8*, ...) #1 ; Function Attrs: noreturn nounwind declare void @exit(i32) #2 -; Function Attrs: nounwind -declare i64 @fread(i8* nocapture, i64, i64, %struct._IO_FILE* nocapture) #1 +declare i64 @fread(i8*, i64, i64, %struct._IO_FILE*) #1 ; Function Attrs: nounwind -declare noalias i8* @memalign(i64, i64) #1 +declare noalias i8* @memalign(i64, i64) #3 -; Function Attrs: nounwind -declare i32 @fclose(%struct._IO_FILE* nocapture) #1 +declare i32 @fclose(%struct._IO_FILE*) #1 ; Function Attrs: nounwind uwtable -define void @outputData(i8* nocapture readonly %fName, float* nocapture %outR, float* nocapture %outI, i32 %numX) #0 { +define void @outputData(i8* %fName, float* %outR, float* %outI, i32 %numX) #0 { + %1 = alloca i8*, align 8 + %2 = alloca float*, align 8 + %3 = alloca float*, align 8 + %4 = alloca i32, align 4 + %fid = alloca %struct._IO_FILE*, align 8 %tmp32 = alloca i32, align 4 - %1 = tail call %struct._IO_FILE* @fopen(i8* %fName, i8* getelementptr inbounds ([2 x i8]* @.str2, i64 0, i64 0)) #6 - %2 = icmp eq %struct._IO_FILE* %1, null - br i1 %2, label %3, label %6 - -; <label>:3 ; preds = %0 - %4 = load %struct._IO_FILE** @stderr, align 8, !tbaa !1 - %5 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8]* @.str3, i64 0, i64 0), i64 24, i64 1, %struct._IO_FILE* %4) #7 - tail call void @exit(i32 -1) #8 + store i8* %fName, i8** %1, align 8 + store float* %outR, float** %2, align 8 + store float* %outI, float** %3, align 8 + store i32 %numX, i32* %4, align 4 + %5 = load i8** %1, align 8 + %6 = call %struct._IO_FILE* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8]* @.str2, i32 0, i32 0)) + store %struct._IO_FILE* %6, %struct._IO_FILE** %fid, align 8 + %7 = load %struct._IO_FILE** %fid, align 8 + %8 = icmp eq %struct._IO_FILE* %7, null + br i1 %8, label %9, label %12 + +; <label>:9 ; preds = %0 + %10 = load %struct._IO_FILE** @stderr, align 8 + %11 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %10, i8* getelementptr inbounds ([25 x i8]* @.str3, i32 0, i32 0)) + call void @exit(i32 -1) #6 unreachable -; <label>:6 ; preds = %0 - store i32 %numX, i32* %tmp32, align 4, !tbaa !5 - %7 = bitcast i32* %tmp32 to i8* - %8 = call i64 @fwrite(i8* %7, i64 4, i64 1, %struct._IO_FILE* %1) #6 - %9 = bitcast float* %outR to i8* - %10 = sext i32 %numX to i64 - %11 = tail call i64 @fwrite(i8* %9, i64 4, i64 %10, %struct._IO_FILE* %1) #6 - %12 = bitcast float* %outI to i8* - %13 = tail call i64 @fwrite(i8* %12, i64 4, i64 %10, %struct._IO_FILE* %1) #6 - %14 = tail call i32 @fclose(%struct._IO_FILE* %1) #6 +; <label>:12 ; preds = %0 + %13 = load i32* %4, align 4 + store i32 %13, i32* %tmp32, align 4 + %14 = bitcast i32* %tmp32 to i8* + %15 = load %struct._IO_FILE** %fid, align 8 + %16 = call i64 @fwrite(i8* %14, i64 4, i64 1, %struct._IO_FILE* %15) + %17 = load float** %2, align 8 + %18 = bitcast float* %17 to i8* + %19 = load i32* %4, align 4 + %20 = sext i32 %19 to i64 + %21 = load %struct._IO_FILE** %fid, align 8 + %22 = call i64 @fwrite(i8* %18, i64 4, i64 %20, %struct._IO_FILE* %21) + %23 = load float** %3, align 8 + %24 = bitcast float* %23 to i8* + %25 = load i32* %4, align 4 + %26 = sext i32 %25 to i64 + %27 = load %struct._IO_FILE** %fid, align 8 + %28 = call i64 @fwrite(i8* %24, i64 4, i64 %26, %struct._IO_FILE* %27) + %29 = load %struct._IO_FILE** %fid, align 8 + %30 = call i32 @fclose(%struct._IO_FILE* %29) ret void } +declare i64 @fwrite(i8*, i64, i64, %struct._IO_FILE*) #1 + +declare noalias i8* @malloc(i64) #1 + +; ------------------ VISC Intrinsics ------------------- +; Return Type of VISC computePhiMag and computeQ +%rtype = type {} +%struct.arg.phiMag = type <{ float*, i64, float*, i64, float*, i64, i32, %rtype }> + +; Function Attrs: nounwind +declare i8* @llvm.visc.launch(i8*, i8*) #0 + +; Function Attrs: nounwind +declare void @llvm.visc.wait(i8*) #0 + +; Function Attrs: nounwind +declare i8* @llvm.visc.createNode(i8*) #0 + +; Function Attrs: nounwind +declare i8* @llvm.visc.createNode1D(i8*, i32) #0 + +; Function Attrs: nounwind +declare i8* @llvm.visc.createNode2D(i8*, i32, i32) #0 + +; Function Attrs: nounwind +declare i8* @llvm.visc.createNode3D(i8*, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare i8* @llvm.visc.createEdge(i8*, i8*, i1, i32, i32) #0 + +; Function Attrs: nounwind +declare i8* @llvm.visc.getNode() #0 + +; Function Attrs: nounwind +declare i8* @llvm.visc.getParentNode(i8*) #0 + +; Function Attrs: nounwind +declare i32 @llvm.visc.getNumDims(i8*) #0 + +; Function Attrs: nounwind +declare i32 @llvm.visc.getNodeInstanceID.x(i8*) #0 + +; Function Attrs: nounwind +declare i32 @llvm.visc.getNodeInstanceID.y(i8*) #0 + +; Function Attrs: nounwind +declare i32 @llvm.visc.getNumNodeInstances.x(i8*) #0 + +; Function Attrs: nounwind +declare i32 @llvm.visc.getNumNodeInstances.y(i8*) #0 + ; Function Attrs: nounwind -declare i64 @fwrite(i8* nocapture, i64, i64, %struct._IO_FILE* nocapture) #1 +declare void @llvm.visc.bind.input(i8*, i32, i32) + +; Function Attrs: nounwind +declare void @llvm.visc.bind.output(i8*, i32, i32) +; ----------------- VISC intrinsics end ------------------ ; Function Attrs: noinline nounwind uwtable -define void @computePhiMag_kernel(float* nocapture readonly %phiR, i64 %bytes_phiR, float* nocapture readonly %phiI, i64 %bytes_phiI, float* nocapture %phiMag, i64 %bytes_phiMag, i32 %numK) #3 { - %1 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_global_id to i32 (i32, ...)*)(i32 0) #6 - %2 = icmp slt i32 %1, %numK - br i1 %2, label %3, label %13 - -; <label>:3 ; preds = %0 - %4 = sext i32 %1 to i64 - %5 = getelementptr inbounds float* %phiR, i64 %4 - %6 = load float* %5, align 4, !tbaa !7 - %7 = getelementptr inbounds float* %phiI, i64 %4 - %8 = load float* %7, align 4, !tbaa !7 - %9 = fmul fast float %6, %6 - %10 = fmul fast float %8, %8 - %11 = fadd fast float %9, %10 - %12 = getelementptr inbounds float* %phiMag, i64 %4 - store float %11, float* %12, align 4, !tbaa !7 - br label %13 +define void @computePhiMag_kernel(float* %phiR, i64 %bytes_phiR, float* %phiI, i64 %bytes_phiI, float* %phiMag, i64 %bytes_phiMag, i32 %numK) #4 { + %1 = alloca float*, align 8 + %2 = alloca i64, align 8 + %3 = alloca float*, align 8 + %4 = alloca i64, align 8 + %5 = alloca float*, align 8 + %6 = alloca i64, align 8 + %7 = alloca i32, align 4 + %indexK = alloca i32, align 4 + %real = alloca float, align 4 + %imag = alloca float, align 4 + store float* %phiR, float** %1, align 8 + store i64 %bytes_phiR, i64* %2, align 8 + store float* %phiI, float** %3, align 8 + store i64 %bytes_phiI, i64* %4, align 8 + store float* %phiMag, float** %5, align 8 + store i64 %bytes_phiMag, i64* %6, align 8 + store i32 %numK, i32* %7, align 4 + %8 = call i32 (i32, ...)* bitcast (i32 (...)* @get_global_id to i32 (i32, ...)*)(i32 0) + store i32 %8, i32* %indexK, align 4 + %9 = load i32* %indexK, align 4 + %10 = load i32* %7, align 4 + %11 = icmp slt i32 %9, %10 + br i1 %11, label %12, label %34 + +; <label>:12 ; preds = %0 + %13 = load i32* %indexK, align 4 + %14 = sext i32 %13 to i64 + %15 = load float** %1, align 8 + %16 = getelementptr inbounds float* %15, i64 %14 + %17 = load float* %16, align 4 + store float %17, float* %real, align 4 + %18 = load i32* %indexK, align 4 + %19 = sext i32 %18 to i64 + %20 = load float** %3, align 8 + %21 = getelementptr inbounds float* %20, i64 %19 + %22 = load float* %21, align 4 + store float %22, float* %imag, align 4 + %23 = load float* %real, align 4 + %24 = load float* %real, align 4 + %25 = fmul fast float %23, %24 + %26 = load float* %imag, align 4 + %27 = load float* %imag, align 4 + %28 = fmul fast float %26, %27 + %29 = fadd fast float %25, %28 + %30 = load i32* %indexK, align 4 + %31 = sext i32 %30 to i64 + %32 = load float** %5, align 8 + %33 = getelementptr inbounds float* %32, i64 %31 + store float %29, float* %33, align 4 + br label %34 -; <label>:13 ; preds = %3, %0 +; <label>:34 ; preds = %12, %0 ret void } -declare i32 @get_global_id(...) #4 +declare i32 @get_global_id(...) #1 ; Function Attrs: noinline nounwind uwtable -define void @computePhiMag(i32 %numK, float* nocapture readonly %phiR, float* nocapture readonly %phiI, float* nocapture %phiMag) #3 { - tail call void @computePhiMag_kernel(float* %phiR, i64 undef, float* %phiI, i64 undef, float* %phiMag, i64 undef, i32 %numK) +define void @computePhiMag(i32 %numK, float* %phiR, float* %phiI, float* %phiMag) #4 { + %1 = alloca i32, align 4 + %2 = alloca float*, align 8 + %3 = alloca float*, align 8 + %4 = alloca float*, align 8 + %phiMagBlocks = alloca i32, align 4 + %DimPhiMagBlock = alloca i64, align 8 + %DimPhiMagGrid = alloca i64, align 8 + %bytes_phi = alloca i64, align 8 + store i32 %numK, i32* %1, align 4 + store float* %phiR, float** %2, align 8 + store float* %phiI, float** %3, align 8 + store float* %phiMag, float** %4, align 8 + %5 = load i32* %1, align 4 + %6 = sdiv i32 %5, 256 + store i32 %6, i32* %phiMagBlocks, align 4 + %7 = load i32* %1, align 4 + %8 = srem i32 %7, 256 + %9 = icmp ne i32 %8, 0 + br i1 %9, label %10, label %13 + +; <label>:10 ; preds = %0 + %11 = load i32* %phiMagBlocks, align 4 + %12 = add nsw i32 %11, 1 + store i32 %12, i32* %phiMagBlocks, align 4 + br label %13 + +; <label>:13 ; preds = %10, %0 + store i64 256, i64* %DimPhiMagBlock, align 8 + %14 = load i32* %phiMagBlocks, align 4 + %15 = mul nsw i32 %14, 256 + %16 = sext i32 %15 to i64 + store i64 %16, i64* %DimPhiMagGrid, align 8 + %17 = load i32* %1, align 4 + %18 = sext i32 %17 to i64 + %19 = mul i64 %18, 4 + store i64 %19, i64* %bytes_phi, align 8 + %20 = load float** %2, align 8 + %21 = load i64* %bytes_phi, align 8 + %22 = load float** %3, align 8 + %23 = load i64* %bytes_phi, align 8 + %24 = load float** %4, align 8 + %25 = load i64* %bytes_phi, align 8 + %26 = load i32* %1, align 4 + call void @computePhiMag_kernel(float* %20, i64 %21, float* %22, i64 %23, float* %24, i64 %25, i32 %26) ret void } ; Function Attrs: noinline nounwind uwtable -define void @computeQ_kernel(i32 %numK, i32 %kGlobalIndex, float* nocapture readonly %x, i64 %bytes_x, float* nocapture readonly %y, i64 %bytes_y, float* nocapture readonly %z, i64 %bytes_z, float* nocapture %Qr, i64 %bytes_Qr, float* nocapture %Qi, i64 %bytes_Qi, %struct.kValues* nocapture readonly %ck, i64 %bytes_ck) #3 { -.preheader613: +define void @computeQ_kernel(i32 %numK, i32 %kGlobalIndex, float* %x, i64 %bytes_x, float* %y, i64 %bytes_y, float* %z, i64 %bytes_z, float* %Qr, i64 %bytes_Qr, float* %Qi, i64 %bytes_Qi, %struct.kValues* %ck, i64 %bytes_ck) #4 { + %1 = alloca i32, align 4 + %2 = alloca i32, align 4 + %3 = alloca float*, align 8 + %4 = alloca i64, align 8 + %5 = alloca float*, align 8 + %6 = alloca i64, align 8 + %7 = alloca float*, align 8 + %8 = alloca i64, align 8 + %9 = alloca float*, align 8 + %10 = alloca i64, align 8 + %11 = alloca float*, align 8 + %12 = alloca i64, align 8 + %13 = alloca %struct.kValues*, align 8 + %14 = alloca i64, align 8 %sX = alloca [4 x float], align 16 %sY = alloca [4 x float], align 16 %sZ = alloca [4 x float], align 16 + %sQr = alloca [4 x float], align 16 %sQi = alloca [4 x float], align 16 - %0 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) #6 - %1 = shl i32 %0, 8 - %2 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) #6 - %3 = shl i32 %2, 2 - %4 = add i32 %1, %3 - %5 = sext i32 %4 to i64 - %6 = getelementptr inbounds float* %x, i64 %5 - %7 = load float* %6, align 4, !tbaa !7 - %8 = getelementptr inbounds [4 x float]* %sX, i64 0, i64 0 - store float %7, float* %8, align 16, !tbaa !7 - %9 = getelementptr inbounds float* %y, i64 %5 - %10 = load float* %9, align 4, !tbaa !7 - %11 = getelementptr inbounds [4 x float]* %sY, i64 0, i64 0 - store float %10, float* %11, align 16, !tbaa !7 - %12 = getelementptr inbounds float* %z, i64 %5 - %13 = load float* %12, align 4, !tbaa !7 - %14 = getelementptr inbounds [4 x float]* %sZ, i64 0, i64 0 - store float %13, float* %14, align 16, !tbaa !7 - %15 = getelementptr inbounds float* %Qr, i64 %5 - %16 = load float* %15, align 4, !tbaa !7 - %17 = getelementptr inbounds float* %Qi, i64 %5 - %18 = load float* %17, align 4, !tbaa !7 - %19 = getelementptr inbounds [4 x float]* %sQi, i64 0, i64 0 - store float %18, float* %19, align 16, !tbaa !7 - %20 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) #6 - %21 = shl i32 %20, 8 - %22 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) #6 - %23 = shl i32 %22, 2 - %24 = or i32 %21, 1 - %25 = add i32 %24, %23 - %26 = sext i32 %25 to i64 - %27 = getelementptr inbounds float* %x, i64 %26 - %28 = load float* %27, align 4, !tbaa !7 - %29 = getelementptr inbounds [4 x float]* %sX, i64 0, i64 1 - store float %28, float* %29, align 4, !tbaa !7 - %30 = getelementptr inbounds float* %y, i64 %26 - %31 = load float* %30, align 4, !tbaa !7 - %32 = getelementptr inbounds [4 x float]* %sY, i64 0, i64 1 - store float %31, float* %32, align 4, !tbaa !7 - %33 = getelementptr inbounds float* %z, i64 %26 - %34 = load float* %33, align 4, !tbaa !7 - %35 = getelementptr inbounds [4 x float]* %sZ, i64 0, i64 1 - store float %34, float* %35, align 4, !tbaa !7 - %36 = getelementptr inbounds float* %Qr, i64 %26 - %37 = load float* %36, align 4, !tbaa !7 - %38 = getelementptr inbounds float* %Qi, i64 %26 - %39 = load float* %38, align 4, !tbaa !7 - %40 = getelementptr inbounds [4 x float]* %sQi, i64 0, i64 1 - store float %39, float* %40, align 4, !tbaa !7 - %41 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) #6 - %42 = shl i32 %41, 8 - %43 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) #6 - %44 = shl i32 %43, 2 - %45 = or i32 %42, 2 - %46 = add i32 %45, %44 - %47 = sext i32 %46 to i64 - %48 = getelementptr inbounds float* %x, i64 %47 - %49 = load float* %48, align 4, !tbaa !7 - %50 = getelementptr inbounds [4 x float]* %sX, i64 0, i64 2 - store float %49, float* %50, align 8, !tbaa !7 - %51 = getelementptr inbounds float* %y, i64 %47 - %52 = load float* %51, align 4, !tbaa !7 - %53 = getelementptr inbounds [4 x float]* %sY, i64 0, i64 2 - store float %52, float* %53, align 8, !tbaa !7 - %54 = getelementptr inbounds float* %z, i64 %47 - %55 = load float* %54, align 4, !tbaa !7 - %56 = getelementptr inbounds [4 x float]* %sZ, i64 0, i64 2 - store float %55, float* %56, align 8, !tbaa !7 - %57 = getelementptr inbounds float* %Qr, i64 %47 - %58 = load float* %57, align 4, !tbaa !7 - %59 = getelementptr inbounds float* %Qi, i64 %47 - %60 = load float* %59, align 4, !tbaa !7 - %61 = getelementptr inbounds [4 x float]* %sQi, i64 0, i64 2 - store float %60, float* %61, align 8, !tbaa !7 - %62 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) #6 - %63 = shl i32 %62, 8 - %64 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) #6 - %65 = shl i32 %64, 2 - %66 = or i32 %63, 3 - %67 = add i32 %66, %65 - %68 = sext i32 %67 to i64 - %69 = getelementptr inbounds float* %x, i64 %68 - %70 = load float* %69, align 4, !tbaa !7 - %71 = getelementptr inbounds [4 x float]* %sX, i64 0, i64 3 - store float %70, float* %71, align 4, !tbaa !7 - %72 = getelementptr inbounds float* %y, i64 %68 - %73 = load float* %72, align 4, !tbaa !7 - %74 = getelementptr inbounds [4 x float]* %sY, i64 0, i64 3 - store float %73, float* %74, align 4, !tbaa !7 - %75 = getelementptr inbounds float* %z, i64 %68 - %76 = load float* %75, align 4, !tbaa !7 - %77 = getelementptr inbounds [4 x float]* %sZ, i64 0, i64 3 - store float %76, float* %77, align 4, !tbaa !7 - %78 = getelementptr inbounds float* %Qr, i64 %68 - %79 = load float* %78, align 4, !tbaa !7 - %80 = getelementptr inbounds float* %Qi, i64 %68 - %81 = load float* %80, align 4, !tbaa !7 - %82 = getelementptr inbounds [4 x float]* %sQi, i64 0, i64 3 - store float %81, float* %82, align 4, !tbaa !7 - %83 = icmp slt i32 %kGlobalIndex, %numK - br i1 %83, label %.lr.ph, label %.preheader - -.lr.ph: ; preds = %.preheader613 - %84 = sub i32 %kGlobalIndex, %numK - %85 = icmp ugt i32 %84, -1024 - %.op = sub i32 0, %84 - %86 = select i1 %85, i32 %.op, i32 1024 - br label %130 - -.preheader: ; preds = %130, %.preheader613 - %87 = phi float [ %81, %.preheader613 ], [ %218, %130 ] - %88 = phi float [ %79, %.preheader613 ], [ %212, %130 ] - %89 = phi float [ %60, %.preheader613 ], [ %200, %130 ] - %90 = phi float [ %58, %.preheader613 ], [ %195, %130 ] - %91 = phi float [ %39, %.preheader613 ], [ %183, %130 ] - %92 = phi float [ %37, %.preheader613 ], [ %178, %130 ] - %93 = phi float [ %18, %.preheader613 ], [ %166, %130 ] - %94 = phi float [ %16, %.preheader613 ], [ %161, %130 ] - %95 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) #6 - %96 = shl i32 %95, 8 - %97 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) #6 - %98 = shl i32 %97, 2 - %99 = add i32 %96, %98 - %100 = sext i32 %99 to i64 - %101 = getelementptr inbounds float* %Qr, i64 %100 - store float %94, float* %101, align 4, !tbaa !7 - %102 = getelementptr inbounds float* %Qi, i64 %100 - store float %93, float* %102, align 4, !tbaa !7 - %103 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) #6 - %104 = shl i32 %103, 8 - %105 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) #6 - %106 = shl i32 %105, 2 - %107 = or i32 %104, 1 - %108 = add i32 %107, %106 - %109 = sext i32 %108 to i64 - %110 = getelementptr inbounds float* %Qr, i64 %109 - store float %92, float* %110, align 4, !tbaa !7 - %111 = getelementptr inbounds float* %Qi, i64 %109 - store float %91, float* %111, align 4, !tbaa !7 - %112 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) #6 - %113 = shl i32 %112, 8 - %114 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) #6 - %115 = shl i32 %114, 2 - %116 = or i32 %113, 2 - %117 = add i32 %116, %115 - %118 = sext i32 %117 to i64 - %119 = getelementptr inbounds float* %Qr, i64 %118 - store float %90, float* %119, align 4, !tbaa !7 - %120 = getelementptr inbounds float* %Qi, i64 %118 - store float %89, float* %120, align 4, !tbaa !7 - %121 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) #6 - %122 = shl i32 %121, 8 - %123 = tail call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) #6 - %124 = shl i32 %123, 2 - %125 = or i32 %122, 3 - %126 = add i32 %125, %124 - %127 = sext i32 %126 to i64 - %128 = getelementptr inbounds float* %Qr, i64 %127 - store float %88, float* %128, align 4, !tbaa !7 - %129 = getelementptr inbounds float* %Qi, i64 %127 - store float %87, float* %129, align 4, !tbaa !7 - ret void + %tx = alloca i32, align 4 + %xIndex = alloca i32, align 4 + %kIndex = alloca i32, align 4 + %kx = alloca float, align 4 + %ky = alloca float, align 4 + %kz = alloca float, align 4 + %pm = alloca float, align 4 + %tx1 = alloca i32, align 4 + %expArg = alloca float, align 4 + %tx2 = alloca i32, align 4 + %xIndex3 = alloca i32, align 4 + store i32 %numK, i32* %1, align 4 + store i32 %kGlobalIndex, i32* %2, align 4 + store float* %x, float** %3, align 8 + store i64 %bytes_x, i64* %4, align 8 + store float* %y, float** %5, align 8 + store i64 %bytes_y, i64* %6, align 8 + store float* %z, float** %7, align 8 + store i64 %bytes_z, i64* %8, align 8 + store float* %Qr, float** %9, align 8 + store i64 %bytes_Qr, i64* %10, align 8 + store float* %Qi, float** %11, align 8 + store i64 %bytes_Qi, i64* %12, align 8 + store %struct.kValues* %ck, %struct.kValues** %13, align 8 + store i64 %bytes_ck, i64* %14, align 8 + store i32 0, i32* %tx, align 4 + br label %15 + +; <label>:15 ; preds = %66, %0 + %16 = load i32* %tx, align 4 + %17 = icmp slt i32 %16, 4 + br i1 %17, label %18, label %69 + +; <label>:18 ; preds = %15 + %19 = call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) + %20 = mul nsw i32 %19, 256 + %21 = call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) + %22 = mul nsw i32 4, %21 + %23 = add nsw i32 %20, %22 + %24 = load i32* %tx, align 4 + %25 = add nsw i32 %23, %24 + store i32 %25, i32* %xIndex, align 4 + %26 = load i32* %xIndex, align 4 + %27 = sext i32 %26 to i64 + %28 = load float** %3, align 8 + %29 = getelementptr inbounds float* %28, i64 %27 + %30 = load float* %29, align 4 + %31 = load i32* %tx, align 4 + %32 = sext i32 %31 to i64 + %33 = getelementptr inbounds [4 x float]* %sX, i32 0, i64 %32 + store float %30, float* %33, align 4 + %34 = load i32* %xIndex, align 4 + %35 = sext i32 %34 to i64 + %36 = load float** %5, align 8 + %37 = getelementptr inbounds float* %36, i64 %35 + %38 = load float* %37, align 4 + %39 = load i32* %tx, align 4 + %40 = sext i32 %39 to i64 + %41 = getelementptr inbounds [4 x float]* %sY, i32 0, i64 %40 + store float %38, float* %41, align 4 + %42 = load i32* %xIndex, align 4 + %43 = sext i32 %42 to i64 + %44 = load float** %7, align 8 + %45 = getelementptr inbounds float* %44, i64 %43 + %46 = load float* %45, align 4 + %47 = load i32* %tx, align 4 + %48 = sext i32 %47 to i64 + %49 = getelementptr inbounds [4 x float]* %sZ, i32 0, i64 %48 + store float %46, float* %49, align 4 + %50 = load i32* %xIndex, align 4 + %51 = sext i32 %50 to i64 + %52 = load float** %9, align 8 + %53 = getelementptr inbounds float* %52, i64 %51 + %54 = load float* %53, align 4 + %55 = load i32* %tx, align 4 + %56 = sext i32 %55 to i64 + %57 = getelementptr inbounds [4 x float]* %sQr, i32 0, i64 %56 + store float %54, float* %57, align 4 + %58 = load i32* %xIndex, align 4 + %59 = sext i32 %58 to i64 + %60 = load float** %11, align 8 + %61 = getelementptr inbounds float* %60, i64 %59 + %62 = load float* %61, align 4 + %63 = load i32* %tx, align 4 + %64 = sext i32 %63 to i64 + %65 = getelementptr inbounds [4 x float]* %sQi, i32 0, i64 %64 + store float %62, float* %65, align 4 + br label %66 + +; <label>:66 ; preds = %18 + %67 = load i32* %tx, align 4 + %68 = add nsw i32 %67, 1 + store i32 %68, i32* %tx, align 4 + br label %15 + +; <label>:69 ; preds = %15 + store i32 0, i32* %kIndex, align 4 + br label %70 + +; <label>:70 ; preds = %157, %69 + %71 = load i32* %kIndex, align 4 + %72 = icmp slt i32 %71, 1024 + br i1 %72, label %73, label %162 + +; <label>:73 ; preds = %70 + %74 = load i32* %2, align 4 + %75 = load i32* %1, align 4 + %76 = icmp slt i32 %74, %75 + br i1 %76, label %77, label %162 + +; <label>:77 ; preds = %73 + %78 = load i32* %kIndex, align 4 + %79 = sext i32 %78 to i64 + %80 = load %struct.kValues** %13, align 8 + %81 = getelementptr inbounds %struct.kValues* %80, i64 %79 + %82 = getelementptr inbounds %struct.kValues* %81, i32 0, i32 0 + %83 = load float* %82, align 4 + store float %83, float* %kx, align 4 + %84 = load i32* %kIndex, align 4 + %85 = sext i32 %84 to i64 + %86 = load %struct.kValues** %13, align 8 + %87 = getelementptr inbounds %struct.kValues* %86, i64 %85 + %88 = getelementptr inbounds %struct.kValues* %87, i32 0, i32 1 + %89 = load float* %88, align 4 + store float %89, float* %ky, align 4 + %90 = load i32* %kIndex, align 4 + %91 = sext i32 %90 to i64 + %92 = load %struct.kValues** %13, align 8 + %93 = getelementptr inbounds %struct.kValues* %92, i64 %91 + %94 = getelementptr inbounds %struct.kValues* %93, i32 0, i32 2 + %95 = load float* %94, align 4 + store float %95, float* %kz, align 4 + %96 = load i32* %kIndex, align 4 + %97 = sext i32 %96 to i64 + %98 = load %struct.kValues** %13, align 8 + %99 = getelementptr inbounds %struct.kValues* %98, i64 %97 + %100 = getelementptr inbounds %struct.kValues* %99, i32 0, i32 3 + %101 = load float* %100, align 4 + store float %101, float* %pm, align 4 + store i32 0, i32* %tx1, align 4 + br label %102 + +; <label>:102 ; preds = %153, %77 + %103 = load i32* %tx1, align 4 + %104 = icmp slt i32 %103, 4 + br i1 %104, label %105, label %156 + +; <label>:105 ; preds = %102 + %106 = load float* %kx, align 4 + %107 = load i32* %tx1, align 4 + %108 = sext i32 %107 to i64 + %109 = getelementptr inbounds [4 x float]* %sX, i32 0, i64 %108 + %110 = load float* %109, align 4 + %111 = fmul fast float %106, %110 + %112 = load float* %ky, align 4 + %113 = load i32* %tx1, align 4 + %114 = sext i32 %113 to i64 + %115 = getelementptr inbounds [4 x float]* %sY, i32 0, i64 %114 + %116 = load float* %115, align 4 + %117 = fmul fast float %112, %116 + %118 = fadd fast float %111, %117 + %119 = load float* %kz, align 4 + %120 = load i32* %tx1, align 4 + %121 = sext i32 %120 to i64 + %122 = getelementptr inbounds [4 x float]* %sZ, i32 0, i64 %121 + %123 = load float* %122, align 4 + %124 = fmul fast float %119, %123 + %125 = fadd fast float %118, %124 + %126 = fmul fast float 0x401921FB60000000, %125 + store float %126, float* %expArg, align 4 + %127 = load float* %pm, align 4 + %128 = fpext float %127 to double + %129 = load float* %expArg, align 4 + %130 = fpext float %129 to double + %131 = call double @cos(double %130) #8 + %132 = fmul fast double %128, %131 + %133 = load i32* %tx1, align 4 + %134 = sext i32 %133 to i64 + %135 = getelementptr inbounds [4 x float]* %sQr, i32 0, i64 %134 + %136 = load float* %135, align 4 + %137 = fpext float %136 to double + %138 = fadd fast double %137, %132 + %139 = fptrunc double %138 to float + store float %139, float* %135, align 4 + %140 = load float* %pm, align 4 + %141 = fpext float %140 to double + %142 = load float* %expArg, align 4 + %143 = fpext float %142 to double + %144 = call double @sin(double %143) #8 + %145 = fmul fast double %141, %144 + %146 = load i32* %tx1, align 4 + %147 = sext i32 %146 to i64 + %148 = getelementptr inbounds [4 x float]* %sQi, i32 0, i64 %147 + %149 = load float* %148, align 4 + %150 = fpext float %149 to double + %151 = fadd fast double %150, %145 + %152 = fptrunc double %151 to float + store float %152, float* %148, align 4 + br label %153 + +; <label>:153 ; preds = %105 + %154 = load i32* %tx1, align 4 + %155 = add nsw i32 %154, 1 + store i32 %155, i32* %tx1, align 4 + br label %102 + +; <label>:156 ; preds = %102 + br label %157 -; <label>:130 ; preds = %._crit_edge, %.lr.ph - %131 = phi float [ %79, %.lr.ph ], [ %212, %._crit_edge ] - %132 = phi float [ %60, %.lr.ph ], [ %200, %._crit_edge ] - %133 = phi float [ %58, %.lr.ph ], [ %195, %._crit_edge ] - %134 = phi float [ %39, %.lr.ph ], [ %183, %._crit_edge ] - %135 = phi float [ %37, %.lr.ph ], [ %178, %._crit_edge ] - %136 = phi float [ %18, %.lr.ph ], [ %166, %._crit_edge ] - %137 = phi float [ %16, %.lr.ph ], [ %161, %._crit_edge ] - %138 = phi float [ %13, %.lr.ph ], [ %.pre14, %._crit_edge ] - %139 = phi float [ %10, %.lr.ph ], [ %.pre, %._crit_edge ] - %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %._crit_edge ] - %140 = getelementptr inbounds %struct.kValues* %ck, i64 %indvars.iv, i32 0 - %141 = load float* %140, align 4, !tbaa !9 - %142 = getelementptr inbounds %struct.kValues* %ck, i64 %indvars.iv, i32 1 - %143 = load float* %142, align 4, !tbaa !11 - %144 = getelementptr inbounds %struct.kValues* %ck, i64 %indvars.iv, i32 2 - %145 = load float* %144, align 4, !tbaa !12 - %146 = getelementptr inbounds %struct.kValues* %ck, i64 %indvars.iv, i32 3 - %147 = load float* %146, align 4, !tbaa !13 - %148 = fpext float %147 to double - %149 = load float* %8, align 16, !tbaa !7 - %150 = fmul fast float %141, %149 - %151 = fmul fast float %143, %139 - %152 = fadd fast float %150, %151 - %153 = fmul fast float %145, %138 - %154 = fadd fast float %152, %153 - %155 = fmul fast float %154, 0x401921FB60000000 - %156 = fpext float %155 to double - %157 = tail call double @cos(double %156) #9 - %158 = fmul fast double %148, %157 - %159 = fpext float %137 to double - %160 = fadd fast double %158, %159 - %161 = fptrunc double %160 to float - %162 = tail call double @sin(double %156) #9 - %163 = fmul fast double %148, %162 - %164 = fpext float %136 to double - %165 = fadd fast double %163, %164 - %166 = fptrunc double %165 to float - store float %166, float* %19, align 16, !tbaa !7 - %167 = fmul fast float %141, %28 - %168 = fmul fast float %143, %31 - %169 = fadd fast float %167, %168 - %170 = fmul fast float %145, %34 - %171 = fadd fast float %169, %170 - %172 = fmul fast float %171, 0x401921FB60000000 - %173 = fpext float %172 to double - %174 = tail call double @cos(double %173) #9 - %175 = fmul fast double %148, %174 - %176 = fpext float %135 to double - %177 = fadd fast double %175, %176 - %178 = fptrunc double %177 to float - %179 = tail call double @sin(double %173) #9 - %180 = fmul fast double %148, %179 - %181 = fpext float %134 to double - %182 = fadd fast double %180, %181 - %183 = fptrunc double %182 to float - store float %183, float* %40, align 4, !tbaa !7 - %184 = fmul fast float %141, %49 - %185 = fmul fast float %143, %52 - %186 = fadd fast float %184, %185 - %187 = fmul fast float %145, %55 - %188 = fadd fast float %186, %187 - %189 = fmul fast float %188, 0x401921FB60000000 - %190 = fpext float %189 to double - %191 = tail call double @cos(double %190) #9 - %192 = fmul fast double %148, %191 - %193 = fpext float %133 to double - %194 = fadd fast double %192, %193 - %195 = fptrunc double %194 to float - %196 = tail call double @sin(double %190) #9 - %197 = fmul fast double %148, %196 - %198 = fpext float %132 to double - %199 = fadd fast double %197, %198 - %200 = fptrunc double %199 to float - store float %200, float* %61, align 8, !tbaa !7 - %201 = fmul fast float %141, %70 - %202 = fmul fast float %143, %73 - %203 = fadd fast float %201, %202 - %204 = fmul fast float %145, %76 - %205 = fadd fast float %203, %204 - %206 = fmul fast float %205, 0x401921FB60000000 - %207 = fpext float %206 to double - %208 = tail call double @cos(double %207) #9 - %209 = fmul fast double %148, %208 - %210 = fpext float %131 to double - %211 = fadd fast double %209, %210 - %212 = fptrunc double %211 to float - %213 = tail call double @sin(double %207) #9 - %214 = fmul fast double %148, %213 - %215 = load float* %82, align 4, !tbaa !7 - %216 = fpext float %215 to double - %217 = fadd fast double %214, %216 - %218 = fptrunc double %217 to float - store float %218, float* %82, align 4, !tbaa !7 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %lftr.wideiv = trunc i64 %indvars.iv.next to i32 - %exitcond = icmp eq i32 %lftr.wideiv, %86 - br i1 %exitcond, label %.preheader, label %._crit_edge - -._crit_edge: ; preds = %130 - %.pre = load float* %11, align 16, !tbaa !7 - %.pre14 = load float* %14, align 16, !tbaa !7 - br label %130 +; <label>:157 ; preds = %156 + %158 = load i32* %kIndex, align 4 + %159 = add nsw i32 %158, 1 + store i32 %159, i32* %kIndex, align 4 + %160 = load i32* %2, align 4 + %161 = add nsw i32 %160, 1 + store i32 %161, i32* %2, align 4 + br label %70 + +; <label>:162 ; preds = %73, %70 + store i32 0, i32* %tx2, align 4 + br label %163 + +; <label>:163 ; preds = %190, %162 + %164 = load i32* %tx2, align 4 + %165 = icmp slt i32 %164, 4 + br i1 %165, label %166, label %193 + +; <label>:166 ; preds = %163 + %167 = call i32 (i32, ...)* bitcast (i32 (...)* @get_group_id to i32 (i32, ...)*)(i32 0) + %168 = mul nsw i32 %167, 256 + %169 = call i32 (i32, ...)* bitcast (i32 (...)* @get_local_id to i32 (i32, ...)*)(i32 0) + %170 = mul nsw i32 4, %169 + %171 = add nsw i32 %168, %170 + %172 = load i32* %tx2, align 4 + %173 = add nsw i32 %171, %172 + store i32 %173, i32* %xIndex3, align 4 + %174 = load i32* %tx2, align 4 + %175 = sext i32 %174 to i64 + %176 = getelementptr inbounds [4 x float]* %sQr, i32 0, i64 %175 + %177 = load float* %176, align 4 + %178 = load i32* %xIndex3, align 4 + %179 = sext i32 %178 to i64 + %180 = load float** %9, align 8 + %181 = getelementptr inbounds float* %180, i64 %179 + store float %177, float* %181, align 4 + %182 = load i32* %tx2, align 4 + %183 = sext i32 %182 to i64 + %184 = getelementptr inbounds [4 x float]* %sQi, i32 0, i64 %183 + %185 = load float* %184, align 4 + %186 = load i32* %xIndex3, align 4 + %187 = sext i32 %186 to i64 + %188 = load float** %11, align 8 + %189 = getelementptr inbounds float* %188, i64 %187 + store float %185, float* %189, align 4 + br label %190 + +; <label>:190 ; preds = %166 + %191 = load i32* %tx2, align 4 + %192 = add nsw i32 %191, 1 + store i32 %192, i32* %tx2, align 4 + br label %163 + +; <label>:193 ; preds = %163 + ret void } -declare i32 @get_group_id(...) #4 +declare i32 @get_group_id(...) #1 -declare i32 @get_local_id(...) #4 +declare i32 @get_local_id(...) #1 ; Function Attrs: nounwind readnone declare double @cos(double) #5 @@ -446,65 +728,188 @@ declare double @cos(double) #5 declare double @sin(double) #5 ; Function Attrs: noinline nounwind uwtable -define void @computeQ(i32 %numK, i32 %numX, float* nocapture readonly %x, float* nocapture readonly %y, float* nocapture readonly %z, %struct.kValues* nocapture readonly %kVals, float* nocapture %Qr, float* nocapture %Qi) #3 { - %1 = sdiv i32 %numK, 1024 - %2 = and i32 %numK, 1023 - %not. = icmp ne i32 %2, 0 - %3 = zext i1 %not. to i32 - %. = add i32 %1, %3 - %4 = sdiv i32 %numX, 256 - %5 = and i32 %numX, 255 - %not.1 = icmp ne i32 %5, 0 - %6 = zext i1 %not.1 to i32 - %QBlocks.0 = add nsw i32 %4, %6 - %7 = shl nsw i32 %QBlocks.0, 8 - %8 = sdiv i32 %7, 4 - %9 = sext i32 %8 to i64 - %10 = icmp sgt i32 %., 0 - br i1 %10, label %.lr.ph, label %._crit_edge - -.lr.ph: ; preds = %0, %.lr.ph - %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ] - %11 = trunc i64 %indvars.iv to i32 - %12 = shl nsw i32 %11, 10 - %13 = sext i32 %12 to i64 - %14 = getelementptr inbounds %struct.kValues* %kVals, i64 %13 - tail call void @computeQ_kernel(i32 %numK, i32 %12, float* %x, i64 undef, float* %y, i64 undef, float* %z, i64 undef, float* %Qr, i64 undef, float* %Qi, i64 undef, %struct.kValues* %14, i64 undef) - %15 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([23 x i8]* @.str4, i64 0, i64 0), i64 %9, i64 64) #6 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %lftr.wideiv = trunc i64 %indvars.iv.next to i32 - %exitcond = icmp eq i32 %lftr.wideiv, %. - br i1 %exitcond, label %._crit_edge, label %.lr.ph - -._crit_edge: ; preds = %.lr.ph, %0 +define void @computeQ(i32 %numK, i32 %numX, float* %x, float* %y, float* %z, %struct.kValues* %kVals, float* %Qr, float* %Qi) #4 { + %1 = alloca i32, align 4 + %2 = alloca i32, align 4 + %3 = alloca float*, align 8 + %4 = alloca float*, align 8 + %5 = alloca float*, align 8 + %6 = alloca %struct.kValues*, align 8 + %7 = alloca float*, align 8 + %8 = alloca float*, align 8 + %QGrids = alloca i32, align 4 + %QBlocks = alloca i32, align 4 + %DimQBlock = alloca i64, align 8 + %DimQGrid = alloca i64, align 8 + %QGrid = alloca i32, align 4 + %QGridBase = alloca i32, align 4 + %kValsTile = alloca %struct.kValues*, align 8 + %numElems = alloca i32, align 4 + %bytes_x = alloca i64, align 8 + %bytes_kValTile = alloca i64, align 8 + store i32 %numK, i32* %1, align 4 + store i32 %numX, i32* %2, align 4 + store float* %x, float** %3, align 8 + store float* %y, float** %4, align 8 + store float* %z, float** %5, align 8 + store %struct.kValues* %kVals, %struct.kValues** %6, align 8 + store float* %Qr, float** %7, align 8 + store float* %Qi, float** %8, align 8 + %9 = load i32* %1, align 4 + %10 = sdiv i32 %9, 1024 + store i32 %10, i32* %QGrids, align 4 + %11 = load i32* %1, align 4 + %12 = srem i32 %11, 1024 + %13 = icmp ne i32 %12, 0 + br i1 %13, label %14, label %17 + +; <label>:14 ; preds = %0 + %15 = load i32* %QGrids, align 4 + %16 = add nsw i32 %15, 1 + store i32 %16, i32* %QGrids, align 4 + br label %17 + +; <label>:17 ; preds = %14, %0 + %18 = load i32* %2, align 4 + %19 = sdiv i32 %18, 256 + store i32 %19, i32* %QBlocks, align 4 + %20 = load i32* %2, align 4 + %21 = srem i32 %20, 256 + %22 = icmp ne i32 %21, 0 + br i1 %22, label %23, label %26 + +; <label>:23 ; preds = %17 + %24 = load i32* %QBlocks, align 4 + %25 = add nsw i32 %24, 1 + store i32 %25, i32* %QBlocks, align 4 + br label %26 + +; <label>:26 ; preds = %23, %17 + store i64 64, i64* %DimQBlock, align 8 + %27 = load i32* %QBlocks, align 4 + %28 = mul nsw i32 %27, 256 + %29 = sdiv i32 %28, 4 + %30 = sext i32 %29 to i64 + store i64 %30, i64* %DimQGrid, align 8 + store i32 0, i32* %QGrid, align 4 + br label %31 + +; <label>:31 ; preds = %76, %26 + %32 = load i32* %QGrid, align 4 + %33 = load i32* %QGrids, align 4 + %34 = icmp slt i32 %32, %33 + br i1 %34, label %35, label %79 + +; <label>:35 ; preds = %31 + %36 = load i32* %QGrid, align 4 + %37 = mul nsw i32 %36, 1024 + store i32 %37, i32* %QGridBase, align 4 + %38 = load %struct.kValues** %6, align 8 + %39 = load i32* %QGridBase, align 4 + %40 = sext i32 %39 to i64 + %41 = getelementptr inbounds %struct.kValues* %38, i64 %40 + store %struct.kValues* %41, %struct.kValues** %kValsTile, align 8 + %42 = load i32* %1, align 4 + %43 = load i32* %QGridBase, align 4 + %44 = sub nsw i32 %42, %43 + %45 = icmp slt i32 1024, %44 + br i1 %45, label %46, label %47 + +; <label>:46 ; preds = %35 + br label %51 + +; <label>:47 ; preds = %35 + %48 = load i32* %1, align 4 + %49 = load i32* %QGridBase, align 4 + %50 = sub nsw i32 %48, %49 + br label %51 + +; <label>:51 ; preds = %47, %46 + %52 = phi i32 [ 1024, %46 ], [ %50, %47 ] + store i32 %52, i32* %numElems, align 4 + %53 = load i32* %2, align 4 + %54 = sext i32 %53 to i64 + %55 = mul i64 %54, 4 + store i64 %55, i64* %bytes_x, align 8 + %56 = load i32* %numElems, align 4 + %57 = sext i32 %56 to i64 + %58 = mul i64 %57, 16 + store i64 %58, i64* %bytes_kValTile, align 8 + %59 = load i32* %1, align 4 + %60 = load i32* %QGridBase, align 4 + %61 = load float** %3, align 8 + %62 = load i64* %bytes_x, align 8 + %63 = load float** %4, align 8 + %64 = load i64* %bytes_x, align 8 + %65 = load float** %5, align 8 + %66 = load i64* %bytes_x, align 8 + %67 = load float** %7, align 8 + %68 = load i64* %bytes_x, align 8 + %69 = load float** %8, align 8 + %70 = load i64* %bytes_x, align 8 + %71 = load %struct.kValues** %kValsTile, align 8 + %72 = load i64* %bytes_kValTile, align 8 + call void @computeQ_kernel(i32 %59, i32 %60, float* %61, i64 %62, float* %63, i64 %64, float* %65, i64 %66, float* %67, i64 %68, float* %69, i64 %70, %struct.kValues* %71, i64 %72) + %73 = load i64* %DimQGrid, align 8 + %74 = load i64* %DimQBlock, align 8 + %75 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([23 x i8]* @.str4, i32 0, i32 0), i64 %73, i64 %74) + br label %76 + +; <label>:76 ; preds = %51 + %77 = load i32* %QGrid, align 4 + %78 = add nsw i32 %77, 1 + store i32 %78, i32* %QGrid, align 4 + br label %31 + +; <label>:79 ; preds = %31 ret void } -; Function Attrs: nounwind -declare i32 @printf(i8* nocapture readonly, ...) #1 +declare i32 @printf(i8*, ...) #1 ; Function Attrs: nounwind uwtable -define void @createDataStructsCPU(i32 %numK, i32 %numX, float** nocapture %phiMag, float** nocapture %Qr, float** nocapture %Qi) #0 { - %1 = sext i32 %numK to i64 - %2 = shl nsw i64 %1, 2 - %3 = tail call noalias i8* @memalign(i64 16, i64 %2) #6 - %4 = bitcast i8* %3 to float* - store float* %4, float** %phiMag, align 8, !tbaa !1 - %5 = sext i32 %numX to i64 - %6 = shl nsw i64 %5, 2 - %7 = tail call noalias i8* @memalign(i64 16, i64 %6) #6 - %8 = bitcast i8* %7 to float* - store float* %8, float** %Qr, align 8, !tbaa !1 - %9 = tail call noalias i8* @memalign(i64 16, i64 %6) #6 +define void @createDataStructsCPU(i32 %numK, i32 %numX, float** %phiMag, float** %Qr, float** %Qi) #0 { + %1 = alloca i32, align 4 + %2 = alloca i32, align 4 + %3 = alloca float**, align 8 + %4 = alloca float**, align 8 + %5 = alloca float**, align 8 + store i32 %numK, i32* %1, align 4 + store i32 %numX, i32* %2, align 4 + store float** %phiMag, float*** %3, align 8 + store float** %Qr, float*** %4, align 8 + store float** %Qi, float*** %5, align 8 + %6 = load i32* %1, align 4 + %7 = sext i32 %6 to i64 + %8 = mul i64 %7, 4 + %9 = call noalias i8* @memalign(i64 16, i64 %8) #7 %10 = bitcast i8* %9 to float* - store float* %10, float** %Qi, align 8, !tbaa !1 + %11 = load float*** %3, align 8 + store float* %10, float** %11, align 8 + %12 = load i32* %2, align 4 + %13 = sext i32 %12 to i64 + %14 = mul i64 %13, 4 + %15 = call noalias i8* @memalign(i64 16, i64 %14) #7 + %16 = bitcast i8* %15 to float* + %17 = load float*** %4, align 8 + store float* %16, float** %17, align 8 + %18 = load i32* %2, align 4 + %19 = sext i32 %18 to i64 + %20 = mul i64 %19, 4 + %21 = call noalias i8* @memalign(i64 16, i64 %20) #7 + %22 = bitcast i8* %21 to float* + %23 = load float*** %5, align 8 + store float* %22, float** %23, align 8 ret void } ; Function Attrs: nounwind uwtable define i32 @main(i32 %argc, i8** %argv) #0 { %1 = alloca i32, align 4 + %2 = alloca i32, align 4 + %3 = alloca i8**, align 8 %numX = alloca i32, align 4 + %numK = alloca i32, align 4 %original_numK = alloca i32, align 4 %kx = alloca float*, align 8 %ky = alloca float*, align 8 @@ -514,227 +919,291 @@ define i32 @main(i32 %argc, i8** %argv) #0 { %z = alloca float*, align 8 %phiR = alloca float*, align 8 %phiI = alloca float*, align 8 + %phiMag = alloca float*, align 8 + %Qr = alloca float*, align 8 + %Qi = alloca float*, align 8 + %kVals = alloca %struct.kValues*, align 8 + %params = alloca %struct.pb_Parameters*, align 8 %timers = alloca %struct.pb_TimerSet, align 8 + %inputK = alloca i32, align 4 %end = alloca i8*, align 8 - store i32 %argc, i32* %1, align 4, !tbaa !5 - %2 = bitcast %struct.pb_TimerSet* %timers to i8* - call void @llvm.lifetime.start(i64 288, i8* %2) #6 - call void @pb_InitializeTimerSet(%struct.pb_TimerSet* %timers) #6 - %3 = call %struct.pb_Parameters* @pb_ReadParameters(i32* %1, i8** %argv) #6 - %4 = getelementptr inbounds %struct.pb_Parameters* %3, i64 0, i32 1 - %5 = load i8*** %4, align 8, !tbaa !14 - %6 = load i8** %5, align 8, !tbaa !1 - %7 = icmp eq i8* %6, null - br i1 %7, label %12, label %8 - -; <label>:8 ; preds = %0 - %9 = getelementptr inbounds i8** %5, i64 1 - %10 = load i8** %9, align 8, !tbaa !1 + %k = alloca i32, align 4 + store i32 0, i32* %1 + store i32 %argc, i32* %2, align 4 + store i8** %argv, i8*** %3, align 8 + call void @pb_InitializeTimerSet(%struct.pb_TimerSet* %timers) + %4 = load i8*** %3, align 8 + %5 = call %struct.pb_Parameters* @pb_ReadParameters(i32* %2, i8** %4) + store %struct.pb_Parameters* %5, %struct.pb_Parameters** %params, align 8 + %6 = load %struct.pb_Parameters** %params, align 8 + %7 = getelementptr inbounds %struct.pb_Parameters* %6, i32 0, i32 1 + %8 = load i8*** %7, align 8 + %9 = getelementptr inbounds i8** %8, i64 0 + %10 = load i8** %9, align 8 %11 = icmp eq i8* %10, null - br i1 %11, label %15, label %12 + br i1 %11, label %19, label %12 -; <label>:12 ; preds = %8, %0 - %13 = load %struct._IO_FILE** @stderr, align 8, !tbaa !1 - %14 = call i64 @fwrite(i8* getelementptr inbounds ([30 x i8]* @.str5, i64 0, i64 0), i64 29, i64 1, %struct._IO_FILE* %13) #7 - call void @exit(i32 -1) #8 +; <label>:12 ; preds = %0 + %13 = load %struct.pb_Parameters** %params, align 8 + %14 = getelementptr inbounds %struct.pb_Parameters* %13, i32 0, i32 1 + %15 = load i8*** %14, align 8 + %16 = getelementptr inbounds i8** %15, i64 1 + %17 = load i8** %16, align 8 + %18 = icmp ne i8* %17, null + br i1 %18, label %19, label %22 + +; <label>:19 ; preds = %12, %0 + %20 = load %struct._IO_FILE** @stderr, align 8 + %21 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %20, i8* getelementptr inbounds ([30 x i8]* @.str5, i32 0, i32 0)) + call void @exit(i32 -1) #6 unreachable -; <label>:15 ; preds = %8 - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 1) #6 - %16 = load i8*** %4, align 8, !tbaa !14 - %17 = load i8** %16, align 8, !tbaa !1 - call void @inputData(i8* %17, i32* %original_numK, i32* %numX, float** %kx, float** %ky, float** %kz, float** %x, float** %y, float** %z, float** %phiR, float** %phiI) - %18 = load i32* %1, align 4, !tbaa !5 - %19 = icmp slt i32 %18, 2 - br i1 %19, label %20, label %22 - -; <label>:20 ; preds = %15 - %21 = load i32* %original_numK, align 4, !tbaa !5 - br label %37 - -; <label>:22 ; preds = %15 - %23 = getelementptr inbounds i8** %argv, i64 1 - %24 = load i8** %23, align 8, !tbaa !1 - %25 = call i64 @strtol(i8* %24, i8** %end, i32 10) #6 - %26 = trunc i64 %25 to i32 - %27 = load i8** %end, align 8, !tbaa !1 - %28 = load i8** %23, align 8, !tbaa !1 - %29 = icmp eq i8* %27, %28 - br i1 %29, label %30, label %33 +; <label>:22 ; preds = %12 + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 1) + %23 = load %struct.pb_Parameters** %params, align 8 + %24 = getelementptr inbounds %struct.pb_Parameters* %23, i32 0, i32 1 + %25 = load i8*** %24, align 8 + %26 = getelementptr inbounds i8** %25, i64 0 + %27 = load i8** %26, align 8 + call void @inputData(i8* %27, i32* %original_numK, i32* %numX, float** %kx, float** %ky, float** %kz, float** %x, float** %y, float** %z, float** %phiR, float** %phiI) + %28 = load i32* %2, align 4 + %29 = icmp slt i32 %28, 2 + br i1 %29, label %30, label %32 ; <label>:30 ; preds = %22 - %31 = load %struct._IO_FILE** @stderr, align 8, !tbaa !1 - %32 = call i64 @fwrite(i8* getelementptr inbounds ([32 x i8]* @.str6, i64 0, i64 0), i64 31, i64 1, %struct._IO_FILE* %31) #7 - call void @exit(i32 -1) #8 + %31 = load i32* %original_numK, align 4 + store i32 %31, i32* %numK, align 4 + br label %56 + +; <label>:32 ; preds = %22 + %33 = load i8*** %3, align 8 + %34 = getelementptr inbounds i8** %33, i64 1 + %35 = load i8** %34, align 8 + %36 = call i64 @strtol(i8* %35, i8** %end, i32 10) #7 + %37 = trunc i64 %36 to i32 + store i32 %37, i32* %inputK, align 4 + %38 = load i8** %end, align 8 + %39 = load i8*** %3, align 8 + %40 = getelementptr inbounds i8** %39, i64 1 + %41 = load i8** %40, align 8 + %42 = icmp eq i8* %38, %41 + br i1 %42, label %43, label %46 + +; <label>:43 ; preds = %32 + %44 = load %struct._IO_FILE** @stderr, align 8 + %45 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %44, i8* getelementptr inbounds ([32 x i8]* @.str6, i32 0, i32 0)) + call void @exit(i32 -1) #6 unreachable -; <label>:33 ; preds = %22 - %34 = load i32* %original_numK, align 4, !tbaa !5 - %35 = icmp slt i32 %26, %34 - %36 = select i1 %35, i32 %26, i32 %34 - br label %37 - -; <label>:37 ; preds = %33, %20 - %38 = phi i32 [ %21, %20 ], [ %34, %33 ] - %numK.0 = phi i32 [ %21, %20 ], [ %36, %33 ] - %39 = load i32* %numX, align 4, !tbaa !5 - %40 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([65 x i8]* @.str7, i64 0, i64 0), i32 %39, i32 %38, i32 %numK.0) #6 - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 6) #6 - %41 = sext i32 %numK.0 to i64 - %42 = shl nsw i64 %41, 2 - %43 = call noalias i8* @memalign(i64 16, i64 %42) #6 - %44 = bitcast i8* %43 to float* - %45 = sext i32 %39 to i64 - %46 = shl nsw i64 %45, 2 - %47 = call noalias i8* @memalign(i64 16, i64 %46) #6 - %48 = bitcast i8* %47 to float* - %49 = call noalias i8* @memalign(i64 16, i64 %46) #6 - %50 = bitcast i8* %49 to float* - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 3) #6 - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 2) #6 - %51 = load float** %phiR, align 8, !tbaa !1 - %52 = load float** %phiI, align 8, !tbaa !1 - call void @computePhiMag(i32 %numK.0, float* %51, float* %52, float* %44) - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 3) #6 - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 6) #6 - %53 = call noalias i8* @calloc(i64 %41, i64 16) #6 - %54 = bitcast i8* %53 to %struct.kValues* - %55 = icmp sgt i32 %numK.0, 0 - br i1 %55, label %.lr.ph, label %._crit_edge - -.lr.ph: ; preds = %37 - %56 = load float** %kx, align 8, !tbaa !1 - %57 = load float** %ky, align 8, !tbaa !1 - %58 = load float** %kz, align 8, !tbaa !1 - br label %59 - -; <label>:59 ; preds = %59, %.lr.ph - %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %59 ] - %60 = getelementptr inbounds float* %56, i64 %indvars.iv - %61 = load float* %60, align 4, !tbaa !7 - %62 = getelementptr inbounds %struct.kValues* %54, i64 %indvars.iv, i32 0 - store float %61, float* %62, align 4, !tbaa !9 - %63 = getelementptr inbounds float* %57, i64 %indvars.iv - %64 = load float* %63, align 4, !tbaa !7 - %65 = getelementptr inbounds %struct.kValues* %54, i64 %indvars.iv, i32 1 - store float %64, float* %65, align 4, !tbaa !11 - %66 = getelementptr inbounds float* %58, i64 %indvars.iv - %67 = load float* %66, align 4, !tbaa !7 - %68 = getelementptr inbounds %struct.kValues* %54, i64 %indvars.iv, i32 2 - store float %67, float* %68, align 4, !tbaa !12 - %69 = getelementptr inbounds float* %44, i64 %indvars.iv - %70 = load float* %69, align 4, !tbaa !7 - %71 = getelementptr inbounds %struct.kValues* %54, i64 %indvars.iv, i32 3 - store float %70, float* %71, align 4, !tbaa !13 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %lftr.wideiv = trunc i64 %indvars.iv.next to i32 - %exitcond = icmp eq i32 %lftr.wideiv, %numK.0 - br i1 %exitcond, label %._crit_edge, label %59 - -._crit_edge: ; preds = %59, %37 - call void @free(i8* %43) #6 - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 3) #6 - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 2) #6 - %72 = load float** %x, align 8, !tbaa !1 - %73 = load float** %y, align 8, !tbaa !1 - %74 = load float** %z, align 8, !tbaa !1 - call void @computeQ(i32 %numK.0, i32 %39, float* %72, float* %73, float* %74, %struct.kValues* %54, float* %48, float* %50) - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 3) #6 - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 6) #6 - %75 = getelementptr inbounds %struct.pb_Parameters* %3, i64 0, i32 0 - %76 = load i8** %75, align 8, !tbaa !16 - %77 = icmp eq i8* %76, null - br i1 %77, label %80, label %78 - -; <label>:78 ; preds = %._crit_edge - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 1) #6 - %79 = load i8** %75, align 8, !tbaa !16 - call void @outputData(i8* %79, float* %48, float* %50, i32 %39) - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 6) #6 - br label %80 - -; <label>:80 ; preds = %._crit_edge, %78 - %81 = load float** %kx, align 8, !tbaa !1 - %82 = bitcast float* %81 to i8* - call void @free(i8* %82) #6 - %83 = load float** %ky, align 8, !tbaa !1 - %84 = bitcast float* %83 to i8* - call void @free(i8* %84) #6 - %85 = load float** %kz, align 8, !tbaa !1 - %86 = bitcast float* %85 to i8* - call void @free(i8* %86) #6 - %87 = bitcast float* %72 to i8* - call void @free(i8* %87) #6 - %88 = bitcast float* %73 to i8* - call void @free(i8* %88) #6 - %89 = bitcast float* %74 to i8* - call void @free(i8* %89) #6 - %90 = bitcast float* %51 to i8* - call void @free(i8* %90) #6 - %91 = bitcast float* %52 to i8* - call void @free(i8* %91) #6 - call void @free(i8* %53) #6 - call void @free(i8* %47) #6 - call void @free(i8* %49) #6 - call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 0) #6 - call void @pb_PrintTimerSet(%struct.pb_TimerSet* %timers) #6 - call void @pb_FreeParameters(%struct.pb_Parameters* %3) #6 - call void @llvm.lifetime.end(i64 288, i8* %2) #6 +; <label>:46 ; preds = %32 + %47 = load i32* %inputK, align 4 + %48 = load i32* %original_numK, align 4 + %49 = icmp slt i32 %47, %48 + br i1 %49, label %50, label %52 + +; <label>:50 ; preds = %46 + %51 = load i32* %inputK, align 4 + br label %54 + +; <label>:52 ; preds = %46 + %53 = load i32* %original_numK, align 4 + br label %54 + +; <label>:54 ; preds = %52, %50 + %55 = phi i32 [ %51, %50 ], [ %53, %52 ] + store i32 %55, i32* %numK, align 4 + br label %56 + +; <label>:56 ; preds = %54, %30 + %57 = load i32* %numX, align 4 + %58 = load i32* %original_numK, align 4 + %59 = load i32* %numK, align 4 + %60 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([65 x i8]* @.str7, i32 0, i32 0), i32 %57, i32 %58, i32 %59) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 6) + %61 = load i32* %numK, align 4 + %62 = load i32* %numX, align 4 + call void @createDataStructsCPU(i32 %61, i32 %62, float** %phiMag, float** %Qr, float** %Qi) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 3) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 2) + %63 = load i32* %numK, align 4 + %64 = load float** %phiR, align 8 + %65 = load float** %phiI, align 8 + %66 = load float** %phiMag, align 8 + call void @computePhiMag(i32 %63, float* %64, float* %65, float* %66) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 3) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 6) + %67 = load i32* %numK, align 4 + %68 = sext i32 %67 to i64 + %69 = call noalias i8* @calloc(i64 %68, i64 16) #7 + %70 = bitcast i8* %69 to %struct.kValues* + store %struct.kValues* %70, %struct.kValues** %kVals, align 8 + store i32 0, i32* %k, align 4 + br label %71 + +; <label>:71 ; preds = %116, %56 + %72 = load i32* %k, align 4 + %73 = load i32* %numK, align 4 + %74 = icmp slt i32 %72, %73 + br i1 %74, label %75, label %119 + +; <label>:75 ; preds = %71 + %76 = load i32* %k, align 4 + %77 = sext i32 %76 to i64 + %78 = load float** %kx, align 8 + %79 = getelementptr inbounds float* %78, i64 %77 + %80 = load float* %79, align 4 + %81 = load i32* %k, align 4 + %82 = sext i32 %81 to i64 + %83 = load %struct.kValues** %kVals, align 8 + %84 = getelementptr inbounds %struct.kValues* %83, i64 %82 + %85 = getelementptr inbounds %struct.kValues* %84, i32 0, i32 0 + store float %80, float* %85, align 4 + %86 = load i32* %k, align 4 + %87 = sext i32 %86 to i64 + %88 = load float** %ky, align 8 + %89 = getelementptr inbounds float* %88, i64 %87 + %90 = load float* %89, align 4 + %91 = load i32* %k, align 4 + %92 = sext i32 %91 to i64 + %93 = load %struct.kValues** %kVals, align 8 + %94 = getelementptr inbounds %struct.kValues* %93, i64 %92 + %95 = getelementptr inbounds %struct.kValues* %94, i32 0, i32 1 + store float %90, float* %95, align 4 + %96 = load i32* %k, align 4 + %97 = sext i32 %96 to i64 + %98 = load float** %kz, align 8 + %99 = getelementptr inbounds float* %98, i64 %97 + %100 = load float* %99, align 4 + %101 = load i32* %k, align 4 + %102 = sext i32 %101 to i64 + %103 = load %struct.kValues** %kVals, align 8 + %104 = getelementptr inbounds %struct.kValues* %103, i64 %102 + %105 = getelementptr inbounds %struct.kValues* %104, i32 0, i32 2 + store float %100, float* %105, align 4 + %106 = load i32* %k, align 4 + %107 = sext i32 %106 to i64 + %108 = load float** %phiMag, align 8 + %109 = getelementptr inbounds float* %108, i64 %107 + %110 = load float* %109, align 4 + %111 = load i32* %k, align 4 + %112 = sext i32 %111 to i64 + %113 = load %struct.kValues** %kVals, align 8 + %114 = getelementptr inbounds %struct.kValues* %113, i64 %112 + %115 = getelementptr inbounds %struct.kValues* %114, i32 0, i32 3 + store float %110, float* %115, align 4 + br label %116 + +; <label>:116 ; preds = %75 + %117 = load i32* %k, align 4 + %118 = add nsw i32 %117, 1 + store i32 %118, i32* %k, align 4 + br label %71 + +; <label>:119 ; preds = %71 + %120 = load float** %phiMag, align 8 + %121 = bitcast float* %120 to i8* + call void @free(i8* %121) #7 + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 3) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 2) + %122 = load i32* %numK, align 4 + %123 = load i32* %numX, align 4 + %124 = load float** %x, align 8 + %125 = load float** %y, align 8 + %126 = load float** %z, align 8 + %127 = load %struct.kValues** %kVals, align 8 + %128 = load float** %Qr, align 8 + %129 = load float** %Qi, align 8 + call void @computeQ(i32 %122, i32 %123, float* %124, float* %125, float* %126, %struct.kValues* %127, float* %128, float* %129) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 3) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 6) + %130 = load %struct.pb_Parameters** %params, align 8 + %131 = getelementptr inbounds %struct.pb_Parameters* %130, i32 0, i32 0 + %132 = load i8** %131, align 8 + %133 = icmp ne i8* %132, null + br i1 %133, label %134, label %141 + +; <label>:134 ; preds = %119 + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 1) + %135 = load %struct.pb_Parameters** %params, align 8 + %136 = getelementptr inbounds %struct.pb_Parameters* %135, i32 0, i32 0 + %137 = load i8** %136, align 8 + %138 = load float** %Qr, align 8 + %139 = load float** %Qi, align 8 + %140 = load i32* %numX, align 4 + call void @outputData(i8* %137, float* %138, float* %139, i32 %140) + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 6) + br label %141 + +; <label>:141 ; preds = %134, %119 + %142 = load float** %kx, align 8 + %143 = bitcast float* %142 to i8* + call void @free(i8* %143) #7 + %144 = load float** %ky, align 8 + %145 = bitcast float* %144 to i8* + call void @free(i8* %145) #7 + %146 = load float** %kz, align 8 + %147 = bitcast float* %146 to i8* + call void @free(i8* %147) #7 + %148 = load float** %x, align 8 + %149 = bitcast float* %148 to i8* + call void @free(i8* %149) #7 + %150 = load float** %y, align 8 + %151 = bitcast float* %150 to i8* + call void @free(i8* %151) #7 + %152 = load float** %z, align 8 + %153 = bitcast float* %152 to i8* + call void @free(i8* %153) #7 + %154 = load float** %phiR, align 8 + %155 = bitcast float* %154 to i8* + call void @free(i8* %155) #7 + %156 = load float** %phiI, align 8 + %157 = bitcast float* %156 to i8* + call void @free(i8* %157) #7 + %158 = load %struct.kValues** %kVals, align 8 + %159 = bitcast %struct.kValues* %158 to i8* + call void @free(i8* %159) #7 + %160 = load float** %Qr, align 8 + %161 = bitcast float* %160 to i8* + call void @free(i8* %161) #7 + %162 = load float** %Qi, align 8 + %163 = bitcast float* %162 to i8* + call void @free(i8* %163) #7 + call void @pb_SwitchToTimer(%struct.pb_TimerSet* %timers, i32 0) + call void @pb_PrintTimerSet(%struct.pb_TimerSet* %timers) + %164 = load %struct.pb_Parameters** %params, align 8 + call void @pb_FreeParameters(%struct.pb_Parameters* %164) ret i32 0 } -; Function Attrs: nounwind -declare void @llvm.lifetime.start(i64, i8* nocapture) #6 - -declare void @pb_InitializeTimerSet(%struct.pb_TimerSet*) #4 +declare void @pb_InitializeTimerSet(%struct.pb_TimerSet*) #1 -declare %struct.pb_Parameters* @pb_ReadParameters(i32*, i8**) #4 +declare %struct.pb_Parameters* @pb_ReadParameters(i32*, i8**) #1 -declare void @pb_SwitchToTimer(%struct.pb_TimerSet*, i32) #4 +declare void @pb_SwitchToTimer(%struct.pb_TimerSet*, i32) #1 ; Function Attrs: nounwind -declare i64 @strtol(i8* readonly, i8** nocapture, i32) #1 +declare i64 @strtol(i8*, i8**, i32) #3 ; Function Attrs: nounwind -declare noalias i8* @calloc(i64, i64) #1 +declare noalias i8* @calloc(i64, i64) #3 ; Function Attrs: nounwind -declare void @free(i8* nocapture) #1 +declare void @free(i8*) #3 -declare void @pb_PrintTimerSet(%struct.pb_TimerSet*) #4 +declare void @pb_PrintTimerSet(%struct.pb_TimerSet*) #1 -declare void @pb_FreeParameters(%struct.pb_Parameters*) #4 +declare void @pb_FreeParameters(%struct.pb_Parameters*) #1 -; Function Attrs: nounwind -declare void @llvm.lifetime.end(i64, i8* nocapture) #6 - -attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } -attributes #2 = { noreturn nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } -attributes #3 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } -attributes #4 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } -attributes #5 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } -attributes #6 = { nounwind } -attributes #7 = { cold nounwind } -attributes #8 = { noreturn nounwind } -attributes #9 = { nounwind readnone } +attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } +attributes #2 = { noreturn nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } +attributes #3 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } +attributes #4 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } +attributes #5 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } +attributes #6 = { noreturn nounwind } +attributes #7 = { nounwind } +attributes #8 = { nounwind readnone } !llvm.ident = !{!0} !0 = metadata !{metadata !"clang version 3.4.2 (tags/RELEASE_34/dot2-final)"} -!1 = metadata !{metadata !2, metadata !2, i64 0} -!2 = metadata !{metadata !"any pointer", metadata !3, i64 0} -!3 = metadata !{metadata !"omnipotent char", metadata !4, i64 0} -!4 = metadata !{metadata !"Simple C/C++ TBAA"} -!5 = metadata !{metadata !6, metadata !6, i64 0} -!6 = metadata !{metadata !"int", metadata !3, i64 0} -!7 = metadata !{metadata !8, metadata !8, i64 0} -!8 = metadata !{metadata !"float", metadata !3, i64 0} -!9 = metadata !{metadata !10, metadata !8, i64 0} -!10 = metadata !{metadata !"kValues", metadata !8, i64 0, metadata !8, i64 4, metadata !8, i64 8, metadata !8, i64 12} -!11 = metadata !{metadata !10, metadata !8, i64 4} -!12 = metadata !{metadata !10, metadata !8, i64 8} -!13 = metadata !{metadata !10, metadata !8, i64 12} -!14 = metadata !{metadata !15, metadata !2, i64 8} -!15 = metadata !{metadata !"pb_Parameters", metadata !2, i64 0, metadata !2, i64 8} -!16 = metadata !{metadata !15, metadata !2, i64 0} -- GitLab