Pārlūkot izejas kodu

Use mad instructions

Tomas Farago 9 gadi atpakaļ
vecāks
revīzija
d85e0a9080
1 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 5 5
      src/kernels/ankabackproject.cl

+ 5 - 5
src/kernels/ankabackproject.cl

@@ -31,12 +31,12 @@
      float2 pixel;
      float3 voxel;
  
-     voxel.x = x_region.x + id.x * x_region.y;
-     voxel.y = y_region.x + id.y * y_region.y;
-     voxel.z = z_region.x + id.z * z_region.y;
+     voxel.x = mad((float) id.x, x_region.y, x_region.x);
+     voxel.y = mad((float) id.y, y_region.y, y_region.x);
+     voxel.z = mad((float) id.z, z_region.y, z_region.x);
  
-     pixel.x = voxel.x * tmatrix.s0 + voxel.y * tmatrix.s1 + tmatrix.s3 - offset.x;
-     pixel.y = voxel.x * tmatrix.s4 + voxel.y * tmatrix.s5 + voxel.z * tmatrix.s6 + tmatrix.s7 - offset.y;
+     pixel.x = mad(voxel.x, tmatrix.s0, mad(voxel.y, tmatrix.s1, tmatrix.s3 - offset.x));
+     pixel.y = mad(voxel.x, tmatrix.s4, mad(voxel.y, tmatrix.s5, mad(voxel.z, tmatrix.s6, tmatrix.s7 - offset.y)));
  
     if (cumulate) {
          volume[id.z * get_global_size (0) * get_global_size (1) +