(Node val, Type t )
| 1130 | // zero/sign extend. "i" is limited to either classic unsigned (min==0) or |
| 1131 | // classic signed (min=minus-power-of-2); max=power-of-2-minus-1. |
| 1132 | private Node zsMask(Node val, Type t ) { |
| 1133 | if( !(val._type instanceof TypeInteger tval && t instanceof TypeInteger t0 && !tval.isa(t0)) ) { |
| 1134 | if( !(val._type instanceof TypeFloat tval && t instanceof TypeFloat t0 && !tval.isa(t0)) ) |
| 1135 | return val; |
| 1136 | // Float rounding |
| 1137 | return peep(new RoundF32Node(val)); |
| 1138 | } |
| 1139 | if( t0._min==0 ) // Unsigned |
| 1140 | return peep(new AndNode(val,con(t0._max))); |
| 1141 | // Signed extension |
| 1142 | int shift = Long.numberOfLeadingZeros(t0._max)-1; |
| 1143 | Node shf = con(shift); |
| 1144 | if( shf._type==TypeInteger.ZERO ) |
| 1145 | return val; |
| 1146 | return peep(new SarNode(peep(new ShlNode(val,shf.keep())),shf.unkeep())); |
| 1147 | } |
| 1148 | |
| 1149 | |
| 1150 | /** |
no test coverage detected