-
Enhancement
-
Resolution: Fixed
-
P4
-
20
-
b12
Vector API binary op "FIRST_NONZERO" represents the vector operation of "a!=0?a:b", which can be implemented with existing APIs like "compare + blend". The current implementation is more complex especially for the floating point type vectors. The main idea of the implementation is:
```
1) mask = a.compare(0, ne);
2) b = b.blend(0, mask);
3) result = a | b;
```
And for the floating point types, it needs the type conversions between the floating point type to the relative integral type, since the final "OR" is only valid for bitwise integral types.
A simpler implementation is:
```
1) mask = a.compare(0, ne);
2) result = a.blend(b, mask);
```
This could save the final "OR" and then the type conversions between FP and integral types.
```
1) mask = a.compare(0, ne);
2) b = b.blend(0, mask);
3) result = a | b;
```
And for the floating point types, it needs the type conversions between the floating point type to the relative integral type, since the final "OR" is only valid for bitwise integral types.
A simpler implementation is:
```
1) mask = a.compare(0, ne);
2) result = a.blend(b, mask);
```
This could save the final "OR" and then the type conversions between FP and integral types.
- duplicates
-
JDK-8291117 [vectorapi] Optimize the java implementation of lanewise FIRST_NONZERO
-
- Closed
-