Add conversion folding when the source is a constant.
authorNeil Henning <neil.henning@amd.com>
Mon, 26 Nov 2018 10:17:33 +0000 (10:17 +0000)
committerNeil Henning <neil.henning@amd.com>
Mon, 26 Nov 2018 12:45:33 +0000 (12:45 +0000)
commit81a63f1de0bc94a8de12c3aa56f4f5d70c8d3a7e
treea3100a23dc81422d050de36e5ccf25bd12e5e3b4
parent0e6c82ce937eff14999cdd510fbe267aaffc27e9
Add conversion folding when the source is a constant.

This change adds unary conversion folding when the source is a constant.
This fixes an ISV issue whereby:

```
const float16_t f = float16_t(42.0);
```

Wouldn't compile because the conversion operator would always produce an
EvqTemporary when it could have produced an EvqConst.

I've also added a test case that proves out that all basic-type to
basic-type conversions work.
Test/baseResults/constantUnaryConversion.comp.out [new file with mode: 0644]
Test/baseResults/spv.16bitstorage-int.frag.out
Test/baseResults/spv.16bitstorage-uint.frag.out
Test/baseResults/spv.16bitstorage.frag.out
Test/baseResults/spv.8bitstorage-int.frag.out
Test/baseResults/spv.8bitstorage-uint.frag.out
Test/constantUnaryConversion.comp [new file with mode: 0644]
glslang/MachineIndependent/Constant.cpp
glslang/MachineIndependent/Intermediate.cpp
glslang/MachineIndependent/localintermediate.h
gtests/AST.FromFile.cpp