Improve uimm128 parsing

This commit changes 128-bit constant parsing in two ways:
 - it adds the ability to use underscores to separate digits when writing a 128-bit constant in hexadecimal; e.g. `0x00010203...` can now be written as `0x0001_0203_...`
 - it adds a new mechanism for parsing 128-bit constants using integer/float/boolean literals; e.g. `vconst.i32x4 [1 2 3 4]`. Note that currently the controlling type of the instruction dictates how many literals to parse inside the brackets.
This commit is contained in:
Andrew Brown
2019-08-28 10:01:19 -07:00
committed by Dan Gohman
parent 98056aa05d
commit d64e454004
6 changed files with 328 additions and 36 deletions

View File

@@ -1,13 +0,0 @@
test rodata
set enable_simd=true
set probestack_enabled=false
target x86_64 haswell
; use baldrdash calling convention here for simplicity (avoids prologue, epilogue)
function %test_vconst_i32() -> i32x4 baldrdash_system_v {
ebb0:
v0 = vconst.i32x4 0x1234
return v0
}
; sameln: [34, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

View File

@@ -0,0 +1,20 @@
test rodata
set enable_simd=true
set probestack_enabled=false
target x86_64 haswell
function %test_vconst_i32() -> i32x4 {
ebb0:
v0 = vconst.i32x4 0x1234
return v0
}
; sameln: [34, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
function %test_vconst_b16() -> b16x8 {
ebb0:
v0 = vconst.b16x8 [true false true false true false true true]
return v0
}
; sameln: [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0]

View File

@@ -0,0 +1,21 @@
test run
set enable_simd
function %test_vconst_syntax() -> b1 {
ebb0:
v0 = vconst.i32x4 0x00000004_00000003_00000002_00000001 ; build constant using hexadecimal syntax
v1 = vconst.i32x4 [1 2 3 4] ; build constant using literal list syntax
; verify lane 1 matches
v2 = extractlane v0, 1
v3 = extractlane v1, 1
v4 = icmp eq v3, v2
; verify lane 1 has the correct value
v5 = icmp_imm eq v3, 2
v6 = band v4, v5
return v6
}
; run