File: phi-spvintrinsic-dominate.ll

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (39 lines) | stat: -rw-r--r-- 1,383 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
; The goal of the test is to check that newly inserted internal (spv)
; intrinsic functions for PHI's operands are inserted at the correct
; positions, and don't break rules of instruction domination and PHI nodes
; grouping at top of basic block.

; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}

; CHECK: OpFunction
; CHECK: OpBranch
; CHECK: OpLabel
; CHECK: OpPhi
; CHECK: OpPhi
; CHECK: OpPhi

define spir_kernel void @foo(ptr addrspace(1) %_arg1) {
entry:
  br label %l1

l1:
  %sw = phi <4 x double> [ %vec, %l2 ], [ <double 0.0, double 0.0, double 0.0, double poison>, %entry ]
  %in = phi <3 x double> [ %ins, %l2 ], [ zeroinitializer, %entry ]
  %r1 = phi i32 [ %r2, %l2 ], [ 0, %entry ]
  %c1 = icmp ult i32 %r1, 3
  br i1 %c1, label %l2, label %exit

l2:
  %r3 = zext nneg i32 %r1 to i64
  %r4 = getelementptr inbounds double, ptr addrspace(1) %_arg1, i64 %r3
  %r5 = load double, ptr addrspace(1) %r4, align 8
  %ins = insertelement <3 x double> %in, double %r5, i32 %r1
  %exp = shufflevector <3 x double> %ins, <3 x double> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison>
  %vec = shufflevector <4 x double> %exp, <4 x double> %sw, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
  %r2 = add nuw nsw i32 %r1, 1
  br label %l1

exit:
  ret void
}