[Mesa-dev] [PATCH 3/3] radeonsi: add GLSL lit tests
Marek Olšák
maraeo at gmail.com
Sun Jul 31 20:29:30 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
They can only be run manually as described in HOW_TO_RUN.
It should help catch suboptimal code generation.
Some of the tests already fail.
---
src/gallium/drivers/radeonsi/glsl_tests/HOW_TO_RUN | 8 ++++
.../drivers/radeonsi/glsl_tests/bitcount.ll | 15 ++++++
.../radeonsi/glsl_tests/bitfield_extract.ll | 34 +++++++++++++
.../drivers/radeonsi/glsl_tests/bitfield_insert.ll | 40 ++++++++++++++++
src/gallium/drivers/radeonsi/glsl_tests/div.ll | 30 ++++++++++++
src/gallium/drivers/radeonsi/glsl_tests/exp2.ll | 14 ++++++
src/gallium/drivers/radeonsi/glsl_tests/fma.ll | 16 +++++++
src/gallium/drivers/radeonsi/glsl_tests/fract.ll | 21 ++++++++
src/gallium/drivers/radeonsi/glsl_tests/frexp.ll | 15 ++++++
src/gallium/drivers/radeonsi/glsl_tests/ldexp.ll | 16 +++++++
src/gallium/drivers/radeonsi/glsl_tests/lit.cfg | 17 +++++++
src/gallium/drivers/radeonsi/glsl_tests/log2.ll | 14 ++++++
.../drivers/radeonsi/glsl_tests/minmax.f32.ll | 30 ++++++++++++
.../drivers/radeonsi/glsl_tests/minmax.f64.ll | 36 ++++++++++++++
.../drivers/radeonsi/glsl_tests/minmax.i32.ll | 32 +++++++++++++
.../drivers/radeonsi/glsl_tests/minmax.u32.ll | 32 +++++++++++++
.../radeonsi/glsl_tests/pack_unpack_half.ll | 37 ++++++++++++++
src/gallium/drivers/radeonsi/glsl_tests/pow.ll | 17 +++++++
src/gallium/drivers/radeonsi/glsl_tests/sqrt.ll | 56 ++++++++++++++++++++++
19 files changed, 480 insertions(+)
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/HOW_TO_RUN
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/bitcount.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/bitfield_extract.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/bitfield_insert.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/div.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/exp2.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/fma.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/fract.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/frexp.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/ldexp.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/lit.cfg
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/log2.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/minmax.f32.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/minmax.f64.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/minmax.i32.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/minmax.u32.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/pack_unpack_half.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/pow.ll
create mode 100644 src/gallium/drivers/radeonsi/glsl_tests/sqrt.ll
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/HOW_TO_RUN b/src/gallium/drivers/radeonsi/glsl_tests/HOW_TO_RUN
new file mode 100644
index 0000000..0427697
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/HOW_TO_RUN
@@ -0,0 +1,8 @@
+Type "make" to build amdgcn_glslc.
+
+amdgcn_glslc works only if radeonsi_dri.so is loaded by libGL.
+It's just a GL application that sets R600_DEBUG and captures stderr.
+
+To run the tests, use llvm-lit from your llvm checkout and run:
+
+ llvm-lit -v *.ll
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/bitcount.ll b/src/gallium/drivers/radeonsi/glsl_tests/bitcount.ll
new file mode 100644
index 0000000..fc9a126
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/bitcount.ll
@@ -0,0 +1,15 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@bitcount:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_bcnt_u32
+; GCN-NEXT: epilog
+
+#shader fs bitcount
+#version 400
+flat in int i;
+out ivec4 o;
+void main() {
+ o.x = bitCount(i);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/bitfield_extract.ll b/src/gallium/drivers/radeonsi/glsl_tests/bitfield_extract.ll
new file mode 100644
index 0000000..08c61af
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/bitfield_extract.ll
@@ -0,0 +1,34 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@bfe_i32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_bfe_i32
+; GCN-NEXT: epilog
+
+#shader fs bfe_i32
+#version 400
+flat in ivec3 v;
+out ivec4 o;
+void main() {
+ o.x = bitfieldExtract(v.x, v.y, v.z);
+}
+
+
+; FUNC-LABEL: {{^}}@bfe_u32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_bfe_u32
+; GCN-NEXT: epilog
+
+#shader fs bfe_u32
+#version 400
+flat in uvec3 v;
+out uvec4 o;
+void main() {
+ o.x = bitfieldExtract(v.x, int(v.y), int(v.z));
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/bitfield_insert.ll b/src/gallium/drivers/radeonsi/glsl_tests/bitfield_insert.ll
new file mode 100644
index 0000000..dc748c3
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/bitfield_insert.ll
@@ -0,0 +1,40 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@bfi_i32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_bfm_b32
+; GCN-NEXT: v_lshlrev_b32
+; GCN-NEXT: v_bfi_b32
+; GCN-NEXT: epilog
+
+#shader fs bfi_i32
+#version 400
+flat in ivec4 v;
+out ivec4 o;
+void main() {
+ o.x = bitfieldInsert(v.x, v.y, v.z, v.w);
+}
+
+
+; FUNC-LABEL: {{^}}@bfi_u32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_bfm_b32
+; GCN-NEXT: v_lshlrev_b32
+; GCN-NEXT: v_bfi_b32
+; GCN-NEXT: epilog
+
+#shader fs bfi_u32
+#version 400
+flat in uvec4 v;
+out uvec4 o;
+void main() {
+ o.x = bitfieldInsert(v.x, v.y, int(v.z), int(v.w));
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/div.ll b/src/gallium/drivers/radeonsi/glsl_tests/div.ll
new file mode 100644
index 0000000..5badc31
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/div.ll
@@ -0,0 +1,30 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@div:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_rcp_f32
+; GCN-NEXT: v_mul_f32
+; GCN-NEXT: epilog
+
+#shader fs div
+#version 400
+flat in vec2 v;
+void main() {
+ gl_FragColor.x = v.x / v.y;
+}
+
+
+; FUNC-LABEL: {{^}}@rcp:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_rcp_f32
+; GCN-NEXT: epilog
+
+#shader fs rcp
+#version 400
+flat in float x;
+void main() {
+ gl_FragColor.x = 1 / x;
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/exp2.ll b/src/gallium/drivers/radeonsi/glsl_tests/exp2.ll
new file mode 100644
index 0000000..ff91705
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/exp2.ll
@@ -0,0 +1,14 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@exp2:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_exp_f32
+; GCN-NEXT: epilog
+
+#shader fs exp2
+#version 400
+flat in float f;
+void main() {
+ gl_FragColor.x = exp2(f);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/fma.ll b/src/gallium/drivers/radeonsi/glsl_tests/fma.ll
new file mode 100644
index 0000000..727716f
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/fma.ll
@@ -0,0 +1,16 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@fma:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_mac_f32
+; GCN-NEXT: epilog
+
+#shader fs fma
+#version 400
+flat in vec3 v;
+void main() {
+ gl_FragColor.x = fma(v.x, v.y, v.z);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/fract.ll b/src/gallium/drivers/radeonsi/glsl_tests/fract.ll
new file mode 100644
index 0000000..4333203
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/fract.ll
@@ -0,0 +1,21 @@
+; RUN: ./amdgcn_glslc -mcpu=tahiti %s | FileCheck -check-prefix=GCN -check-prefix=FUNC -check-prefix=SI %s
+; RUN: ./amdgcn_glslc -mcpu=bonaire %s | FileCheck -check-prefix=GCN -check-prefix=FUNC -check-prefix=CI %s
+; RUN: ./amdgcn_glslc -mcpu=tonga %s | FileCheck -check-prefix=GCN -check-prefix=FUNC -check-prefix=CI %s
+
+; Only SI has buggy v_fract and must use v_floor.
+; The amdgcn.fract intrinsic can be used only if LLVM passes are able to move it.
+
+; FUNC-LABEL: {{^}}@fract:
+; GCN: main
+; GCN: v_interp_mov
+; SI-NEXT: v_floor_f32
+; SI-NEXT: v_subrev_f32
+; CI-NEXT: v_fract_f32
+; GCN-NEXT: epilog
+
+#shader fs fract
+#version 400
+flat in float f;
+void main() {
+ gl_FragColor.x = fract(f);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/frexp.ll b/src/gallium/drivers/radeonsi/glsl_tests/frexp.ll
new file mode 100644
index 0000000..d6295a2
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/frexp.ll
@@ -0,0 +1,15 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@frexp:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-DAG: v_frexp_mant_f32
+; GCN-DAG: v_frexp_exp_i32_f32
+; GCN-NEXT: epilog
+
+#shader fs frexp
+#version 400
+flat in float f;
+void main() {
+ gl_FragColor.x = frexp(f, gl_FragColor.y);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/ldexp.ll b/src/gallium/drivers/radeonsi/glsl_tests/ldexp.ll
new file mode 100644
index 0000000..920a0a5
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/ldexp.ll
@@ -0,0 +1,16 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@ldexp:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_ldexp_f32
+; GCN-NEXT: epilog
+
+#shader fs ldexp
+#version 400
+flat in float f;
+flat in int i;
+void main() {
+ gl_FragColor.x = ldexp(f, i);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/lit.cfg b/src/gallium/drivers/radeonsi/glsl_tests/lit.cfg
new file mode 100644
index 0000000..1881023
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/lit.cfg
@@ -0,0 +1,17 @@
+# -*- Python -*-
+
+# Configuration file for the 'lit' test runner.
+
+import os
+import sys
+import re
+import platform
+
+import lit.util
+import lit.formats
+
+# name: The name of this test suite.
+config.name = 'GLSL'
+
+# testFormat: The test format to use to interpret tests.
+config.test_format = lit.formats.ShTest(execute_external = True)
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/log2.ll b/src/gallium/drivers/radeonsi/glsl_tests/log2.ll
new file mode 100644
index 0000000..623357a
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/log2.ll
@@ -0,0 +1,14 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@log2:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_log_f32
+; GCN-NEXT: epilog
+
+#shader fs log2
+#version 400
+flat in float f;
+void main() {
+ gl_FragColor.x = log2(f);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/minmax.f32.ll b/src/gallium/drivers/radeonsi/glsl_tests/minmax.f32.ll
new file mode 100644
index 0000000..12b7a33
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/minmax.f32.ll
@@ -0,0 +1,30 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@min_f32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_min_f32
+; GCN-NEXT: epilog
+
+#shader fs min_f32
+#version 400
+flat in vec2 v;
+void main() {
+ gl_FragColor.x = min(v.x, v.y);
+}
+
+
+; FUNC-LABEL: {{^}}@max_f32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_max_f32
+; GCN-NEXT: epilog
+
+#shader fs max_f32
+#version 400
+flat in vec2 v;
+void main() {
+ gl_FragColor.x = max(v.x, v.y);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/minmax.f64.ll b/src/gallium/drivers/radeonsi/glsl_tests/minmax.f64.ll
new file mode 100644
index 0000000..8952eaa
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/minmax.f64.ll
@@ -0,0 +1,36 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@min_f64:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_min_f64
+; GCN-NEXT: epilog
+
+#shader fs min_f64
+#version 400
+flat in dvec2 v;
+out uvec4 o;
+void main() {
+ o.xy = unpackDouble2x32(min(v.x, v.y));
+}
+
+
+; FUNC-LABEL: {{^}}@max_f64:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_max_f64
+; GCN-NEXT: epilog
+
+#shader fs max_f64
+#version 400
+flat in dvec2 v;
+out uvec4 o;
+void main() {
+ o.xy = unpackDouble2x32(max(v.x, v.y));
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/minmax.i32.ll b/src/gallium/drivers/radeonsi/glsl_tests/minmax.i32.ll
new file mode 100644
index 0000000..e8468a0
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/minmax.i32.ll
@@ -0,0 +1,32 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@min_i32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_min_i32
+; GCN-NEXT: epilog
+
+#shader fs min_i32
+#version 400
+flat in ivec2 v;
+out ivec4 o;
+void main() {
+ o.x = min(v.x, v.y);
+}
+
+
+; FUNC-LABEL: {{^}}@max_i32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_max_i32
+; GCN-NEXT: epilog
+
+#shader fs max_i32
+#version 400
+flat in ivec2 v;
+out ivec4 o;
+void main() {
+ o.x = max(v.x, v.y);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/minmax.u32.ll b/src/gallium/drivers/radeonsi/glsl_tests/minmax.u32.ll
new file mode 100644
index 0000000..2e104de
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/minmax.u32.ll
@@ -0,0 +1,32 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@min_u32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_min_u32
+; GCN-NEXT: epilog
+
+#shader fs min_u32
+#version 400
+flat in uvec2 v;
+out uvec4 o;
+void main() {
+ o.x = min(v.x, v.y);
+}
+
+
+; FUNC-LABEL: {{^}}@max_u32:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_max_u32
+; GCN-NEXT: epilog
+
+#shader fs max_u32
+#version 400
+flat in uvec2 v;
+out uvec4 o;
+void main() {
+ o.x = max(v.x, v.y);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/pack_unpack_half.ll b/src/gallium/drivers/radeonsi/glsl_tests/pack_unpack_half.ll
new file mode 100644
index 0000000..d744d71
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/pack_unpack_half.ll
@@ -0,0 +1,37 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; We don't want any "v_and" or "v_or" here. v_cvt_f16 only writes the lower 16 bits.
+
+; FUNC-LABEL: {{^}}@packhalf:
+; GCN: main
+; GCN: v_interp_mov
+; GCN: v_interp_mov
+; GCN-NEXT: v_cvt_f16_f32
+; GCN-NEXT: v_lshlrev_b32
+; GCN-NEXT: v_cvt_f16_f32
+; GCN-NEXT: epilog
+
+#shader fs packhalf
+#version 420
+flat in vec2 v;
+out uvec4 o;
+void main() {
+ o.x = packHalf2x16(v);
+}
+
+
+; FUNC-LABEL: {{^}}@unpackhalf:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_cvt_f32_f16
+; GCN-NEXT: v_lshrrev_b32
+; GCN-NEXT: v_cvt_f32_f16
+; GCN-NEXT: epilog
+
+#shader fs unpackhalf
+#version 420
+flat in uint u;
+out vec4 o;
+void main() {
+ o.xy = unpackHalf2x16(u);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/pow.ll b/src/gallium/drivers/radeonsi/glsl_tests/pow.ll
new file mode 100644
index 0000000..5850083
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/pow.ll
@@ -0,0 +1,17 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@pow:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_log_f32
+; GCN-NEXT: v_interp_mov
+; GCN-NEXT: v_mul_legacy_f32
+; GCN-NEXT: v_exp_f32
+; GCN-NEXT: epilog
+
+#shader fs pow
+#version 400
+flat in vec2 v;
+void main() {
+ gl_FragColor.x = pow(v.x, v.y);
+}
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/sqrt.ll b/src/gallium/drivers/radeonsi/glsl_tests/sqrt.ll
new file mode 100644
index 0000000..c6ddc54
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/glsl_tests/sqrt.ll
@@ -0,0 +1,56 @@
+; RUN: ./amdgcn_glslc %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
+
+; FUNC-LABEL: {{^}}@sqrt:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_sqrt_f32
+; GCN-NEXT: epilog
+
+#shader fs sqrt
+#version 400
+flat in float f;
+void main() {
+ gl_FragColor.x = sqrt(f);
+}
+
+
+; FUNC-LABEL: {{^}}@inv_sqrt:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_rsq_f32
+; GCN-NEXT: epilog
+
+#shader fs inv_sqrt
+#version 400
+flat in float f;
+void main() {
+ gl_FragColor.x = 1 / sqrt(f);
+}
+
+
+; FUNC-LABEL: {{^}}@rsq:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_rsq_f32
+; GCN-NEXT: epilog
+
+#shader fs rsq
+#version 400
+flat in float f;
+void main() {
+ gl_FragColor.x = inversesqrt(f);
+}
+
+
+; FUNC-LABEL: {{^}}@inv_rsq:
+; GCN: main
+; GCN: v_interp_mov
+; GCN-NEXT: v_sqrt_f32
+; GCN-NEXT: epilog
+
+#shader fs inv_rsq
+#version 400
+flat in float f;
+void main() {
+ gl_FragColor.x = 1 / inversesqrt(f);
+}
--
2.7.4
More information about the mesa-dev
mailing list