RFR: 8266962: Add arch supporting check for "Op_VectorLoadConst" before creating the node

Xiaohong Gong xgong at openjdk.java.net
Wed May 19 03:39:38 UTC 2021


On Tue, 18 May 2021 11:23:32 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> > As far as I know the VectorLoadConst is used here to get the initial shuffle iota of the vector. I'm not so clear about what the iota vector constant materialization you mean.
> 
> `VectorLoadConst` is backed by a constant in `StubRoutines`. Instead, the constant can be materialized as a on-heap ByteVector instance, cached in a static final field, and passed into the intrinsic.
> 
> An alternative approach would be to replace `VectorLoadConst` with a `LoadVector` which performs raw vector access at `StubRoutines::_vector_iota_indices` address.
> 
> All in all, I don't see `VectorLoadConst` well-justified.
> 
> ```
> src/hotspot/cpu/aarch64/aarch64_neon.ad:
> 
>   3369 instruct loadcon8B(vecD dst, immI0 src)
>   3374   match(Set dst (VectorLoadConst src));
>   3378     __ lea(rscratch1, ExternalAddress(StubRoutines::aarch64::vector_iota_indices()));
> 
> 
> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp:
> 
>   7055     StubRoutines::aarch64::_vector_iota_indices    = generate_iota_indices("iota_indices");
> 
>    618   // Generate indices for iota vector.
>    619   address generate_iota_indices(const char *stub_name) {
>    620     __ align(CodeEntryAlignment);
>    621     StubCodeMark mark(this, "StubRoutines", stub_name);
>    622     address start = __ pc();
>    623     __ emit_data64(0x0706050403020100, relocInfo::none);
>    624     __ emit_data64(0x0F0E0D0C0B0A0908, relocInfo::none);
>    625     return start;
>    626   }
> ```

Thanks for your explanation! Yes, currently `VectorLoadConst` is implemented by loading the constant in StubRoutines. And the alternative way that passing a static final instance (like `ByteMaxShuffle.IOTA`) to the intrinisc makes sense to me. Maybe we can revisit it as a kind of optimization in future? Thanks!

-------------

PR: https://git.openjdk.java.net/jdk/pull/4023


More information about the hotspot-compiler-dev mailing list