File: bool-store-vector.ispc

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (28 lines) | stat: -rw-r--r-- 756 bytes parent folder | download
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
// RUN: %{ispc} --target=host --nowrap --nostdlib -O2 --emit-llvm-text %s -o - | FileCheck %s

// REQUIRES: X86_ENABLED

// Storage bools need to be zero extended
uniform bool<4> x;

// CHECK-LABEL: @foo___unT_3C_4_3E_unT_3C_4_3E_(
// CHECK-NEXT: allocas:
// CHECK-NEXT: [[CMP:%.*]] = icmp ult <4 x i8> %a, %b
// CHECK-NEXT: [[CAST:%.*]] = zext <4 x i1> [[CMP]] to <4 x i8>
// CHECK-NEXT: store <4 x i8> [[CAST]], {{.*}} @x
// CHECK-NEXT: ret void

void foo(uniform uint8<4> a, uniform uint8<4> b)
{
    x = a < b;
}

// CHECK-LABEL: @boo___unb_3C_4_3E_(
// CHECK-NEXT: allocas:
// CHECK-NEXT: [[CAST:%.*]] = zext <4 x i1> %a to <4 x i8>
// CHECK-NEXT: store <4 x i8> [[CAST]], {{.*}} @x
// CHECK-NEXT: ret void

void boo(uniform bool<4> a) {
    x = a;
}