TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.38k stars 229 forks source link

Add scalable vector #542

Closed my4ng closed 1 month ago

my4ng commented 1 month ago

Description

This adds scalable vector support through the new ScalableVectorType and ScalableVectorValue.

Related Issue

541

How This Has Been Tested

Tests mirroring the fixed vector kind have been added for type, value and builder.

Checklist

my4ng commented 1 month ago

It appears that a separate ScalableVectorType is required to ensure type safety, rather than reusing VectorType, to ensure fixed and scalable values do not mix in operations.

my4ng commented 1 month ago

It has been tested against the workflow.

The ScalableVectorType/Value are available across all versions; however, the scalable_vec_type functions are gated by #[llvm_versions(12..)], therefore it is not possible to construct a type or value in version less than 12. The doctests in them are ignored since it fails without the aforementioned functions. The alternative approach of hiding the type and value in versions less than 12 is a lot more involved and thus not taken.

my4ng commented 1 month ago

@TheDan64 sorry I have been away and forgot to fix a replace in the fixed vector type doc comments: https://github.com/TheDan64/inkwell/blob/8bd9f087c7fedd3897016568184aa8516d6a0abf/src/types/float_type.rs#L67-L80

Do you mind fixing it in master? Thanks!

TheDan64 commented 3 weeks ago

@my4ng fix what exactly?

my4ng commented 3 weeks ago

@TheDan64 It should be vector type rather than scalar vector type for the doc comment linked as it is the normal vec_type function.