Page MenuHomePhabricator

[LLVM IR] Add `vscale` as a symbolic constant.
AbandonedPublic

Authored by sdesmalen on Sep 30 2019, 2:26 AM.

Details

Summary

Scalable vector types are defined as <vscale x #elts x #eltty>,
where vscale itself is defined as a positive symbolic constant
of type integer. The value is unknown at compile time, but
guaranteed to be constant throughout the IR.

This patch adds vscale as a symbolic constant to the IR, similar to
undef and zeroinitializer, so that it can be used in constant
expressions.

Diff Detail

Event Timeline

sdesmalen created this revision.Sep 30 2019, 2:26 AM

Missing langref changes.

sdesmalen updated this revision to Diff 222398.Sep 30 2019, 5:44 AM

Added section describing vscale in LangRef.
(Thanks @lebedev.ri for pointing out!)

fhahn added a subscriber: fhahn.Oct 1 2019, 2:04 AM
khchen added a subscriber: khchen.Oct 1 2019, 6:22 PM

Looks pretty good. This could probably use some tests in TypeAndConstantValueParsing of llvm/unittests/AsmParser/AsmParserTest.cpp. In particular, an isa<VScale>(...) test would be good. And maybe a negative test to make sure something like <undef x 2 x f64> can't be parsed.

sdesmalen abandoned this revision.Jan 23 2020, 5:57 AM

Superseded by D68203.