Commit Graph

16 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
ebf5c80959 Add Intel encodings for more conversion instructions.
The following instructions have simple encodings:

- bitcast.f32.i32
- bitcast.i32.f32
- bitcast.f64.i64
- bitcast.i64.f64
- fpromote.f64.f32
- fdemote.f32.f64

Also add helper functions enc_flt() and enc_i32_i64 to
intel.encodings.py for generating the common set of encodings for an
instruction: I32, I64 w/REX, I64 w/o REX.
2017-07-27 11:08:41 -07:00
Jakob Stoklund Olesen
014d9a14fe Intel encodings for fadd, fsub, fmul, fdiv. 2017-07-20 10:40:11 -07:00
Jakob Stoklund Olesen
4df6741a90 Add some signed int to float conversions.
These map to single Intel instructions.

The i64 to float conversions are not tested yet. The encoding tables
can't yet differentiate instructions on a secondary type variable alone.
2017-07-19 15:35:13 -07:00
Jakob Stoklund Olesen
e8acad5070 Intel encodings for trap.
Use a ud2 instruction which generates an undefined instruction
exception.
2017-07-19 15:01:32 -07:00
Jakob Stoklund Olesen
b804bc8fbc Add Intel encodings for sextend and uextend. 2017-07-19 13:46:49 -07:00
Jakob Stoklund Olesen
444f955466 Add a null encoding for ireduce.i32.i64.
This conversion doesn't require any code, we're just looking at the bits
differently.
2017-07-19 13:11:11 -07:00
Jakob Stoklund Olesen
13190fd512 Add tests for WebAssembly i64 operators.
This only works on 64-bit haswell for now. We need more legalization
patterns for 32-bit ISAs.
2017-07-19 12:56:54 -07:00
Jakob Stoklund Olesen
bd55bd74cc Add tests for WebAssembly i32 comparisons.
One function for each comparison operator.
2017-07-19 12:36:36 -07:00
Jakob Stoklund Olesen
5a81831c69 Don't require that the fallthrough instruction has an encoding.
A fallthrough jump is actually represented as 0 bytes, so no encoding is
needed.

Also allow for unencoded instructions in the generated emit_inst
implementations. The verifier has stricter rules for when this is
allowed.
2017-07-19 09:30:04 -07:00
Jakob Stoklund Olesen
0a7087732e Add Intel encodings for jump and branch instructions.
Just implement jump, brz, and brnz as needed for WebAssembly.
2017-07-19 09:15:19 -07:00
Jakob Stoklund Olesen
02fd83cd5c Add Intel encodings for imul. 2017-07-18 09:27:36 -07:00
Jakob Stoklund Olesen
e3ff551c2b Add Intel BMI1 ctz and clz encodings. 2017-07-14 14:01:02 -07:00
Jakob Stoklund Olesen
d8e2cb2b42 Add some ISA predicates for Intel CPUID features.
Guard the popcnt instruction on the proper CPUID bits.
2017-07-12 16:05:20 -07:00
Jakob Stoklund Olesen
b6f2f0d862 Add Intel encodings for popcnt.
Change the result type for the bit-counting instructions from a fixed i8
to the iB type variable which is the type of the input. This matches the
convention in WebAssembly, and at least Intel's instructions will set a
full register's worth of count result, even if it is always < 64.

Duplicate the Intel 'ur' encoding recipe into 'umr' and 'urm' variants
corresponding to the RM and MR encoding variants. The difference is
which register is encoded as 'reg' and which is 'r/m' in the ModR/M
byte. A 'mov' register copy uses the MR variant, a unary popcnt uses the
RM variant.
2017-07-12 14:17:16 -07:00
Jakob Stoklund Olesen
5615e4a9e7 Add Intel encodings for shift and rotate instructions. 2017-07-12 13:12:24 -07:00
Jakob Stoklund Olesen
3d738d01bb Add a WebAssembly filetests directory.
Start adding little 'test compile' test cases which check that the full
compilation pipeline works for each WebAssembly instruction.
2017-07-12 12:22:50 -07:00