(Node val, Type t )
| 830 | // zero/sign extend. "i" is limited to either classic unsigned (min==0) or |
| 831 | // classic signed (min=minus-power-of-2); max=power-of-2-minus-1. |
| 832 | private Node zsMask(Node val, Type t ) { |
| 833 | if( !(val._type instanceof TypeInteger tval && t instanceof TypeInteger t0 && !tval.isa(t0)) ) { |
| 834 | if( !(val._type instanceof TypeFloat tval && t instanceof TypeFloat t0 && !tval.isa(t0)) ) |
| 835 | return val; |
| 836 | // Float rounding |
| 837 | return new RoundF32Node(val).peephole(); |
| 838 | } |
| 839 | if( t0._min==0 ) // Unsigned |
| 840 | return new AndNode(val,con(t0._max)).peephole(); |
| 841 | // Signed extension |
| 842 | int shift = Long.numberOfLeadingZeros(t0._max)-1; |
| 843 | Node shf = con(shift); |
| 844 | if( shf._type==TypeInteger.ZERO ) |
| 845 | return val; |
| 846 | return new SarNode(new ShlNode(val,shf.keep()).peephole(),shf.unkeep()).peephole(); |
| 847 | } |
| 848 | |
| 849 | |
| 850 | /** |
no test coverage detected