snake5

shader compiler IR dump - constant propagation 2

Jan 4th, 2018
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LLVM 1.87 KB | None | 0 0
  1. ----- subtest:[unary operators] -----
  2. function float4 main():POSITION // mangledName=main
  3. {
  4.   return cast[float4] binop(+) [float]
  5.   {
  6.     binop(+) [float]
  7.     {
  8.       binop(+) [float]
  9.       {
  10.         binop(+) [float]
  11.         {
  12.           cast[float] int32(0)
  13.           unop(-) [float]
  14.           {
  15.             float32(0.1)
  16.           }
  17.         }
  18.         cast[float] unop(~) [int]
  19.         {
  20.           unop(~) [int]
  21.           {
  22.             int32(0)
  23.           }
  24.         }
  25.       }
  26.       cast[float] unop(!) [bool]
  27.       {
  28.         cast[bool] int32(0)
  29.       }
  30.     }
  31.     cast[float] unop(!) [bool]
  32.     {
  33.       unop(!) [bool]
  34.       {
  35.         bool(0)
  36.       }
  37.     }
  38.   }
  39. }
  40.  
  41. original IR:
  42. module
  43. {
  44.   struct:00E6B088:main__ret{ [4 x f32] __RetVal:POSITION }
  45.   function 'main'() -> struct:00E6B088:main__ret
  46.   {
  47.     block
  48.     {
  49.       00E63780 = cast f32 i32:0
  50.       00E63B20 = neg(f32:0.1)
  51.       00E79900 = add(00E63780,00E63B20)
  52.       00E6B110 = bitwise-inv(i32:0)
  53.       00E81A38 = bitwise-inv(00E6B110)
  54.       00E81A98 = cast f32 00E81A38
  55.       00E79CF0 = add(00E79900,00E81A98)
  56.       00E81AF8 = cast i1 i32:0
  57.       00E7A168 = logical-inv(00E81AF8)
  58.       00E7A1C8 = cast f32 00E7A168
  59.       00E79970 = add(00E79CF0,00E7A1C8)
  60.       00E82B98 = logical-inv(i1:0)
  61.       00E82EF8 = logical-inv(00E82B98)
  62.       00E82FB8 = cast f32 00E82EF8
  63.       00E79660 = add(00E79970,00E82FB8)
  64.       00E82D18 = cast [4 x f32] 00E79660
  65.       00E83018 = aggregate struct:00E6B088:main__ret (00E82D18)
  66.       ret struct:00E6B088:main__ret 00E83018
  67.     }
  68.   }
  69. }
  70. optimized IR:
  71. module
  72. {
  73.   struct:00E6B088:main__ret{ [4 x f32] __RetVal:POSITION }
  74.   function 'main'() -> struct:00E6B088:main__ret
  75.   {
  76.     block
  77.     {
  78.       00E82D18 = cast [4 x f32] f32:0.9
  79.       00E83018 = aggregate struct:00E6B088:main__ret (00E82D18)
  80.       ret struct:00E6B088:main__ret 00E83018
  81.     }
  82.   }
  83. }
Add Comment
Please, Sign In to add comment