File: mad.ll

package info (click to toggle)
intel-graphics-compiler 1.0.17791.18-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 102,312 kB
  • sloc: cpp: 935,343; lisp: 286,143; ansic: 16,196; python: 3,279; yacc: 2,487; lex: 1,642; pascal: 300; sh: 174; makefile: 27
file content (118 lines) | stat: -rw-r--r-- 4,629 bytes parent folder | download | duplicates (2)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2023 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================

; RUN: %opt %use_old_pass_manager% -GenXPatternMatch --enable-mad=true -march=genx64 -mcpu=XeHPC -mtriple=spir64-unknown-unknown -S < %s | FileCheck %s

define <16 x i32> @test_mul_add_i32(<16 x i32> %op0, <16 x i32> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_add_i32
; CHECK: %mul = mul <16 x i32> %op0, %op1
; CHECK: %add = add <16 x i32> %op2, %mul
  %mul = mul <16 x i32> %op0, %op1
  %add = add <16 x i32> %op2, %mul
  ret <16 x i32> %add
}

define <16 x i32> @test_mul_radd_i32(<16 x i32> %op0, <16 x i32> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_radd_i32
; CHECK: %mul = mul <16 x i32> %op0, %op1
; CHECK: %add = add <16 x i32> %mul, %op2
  %mul = mul <16 x i32> %op0, %op1
  %add = add <16 x i32> %mul, %op2
  ret <16 x i32> %add
}

define <16 x i32> @test_mul_sub_i32(<16 x i32> %op0, <16 x i32> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_sub_i32
; CHECK: %mul = mul <16 x i32> %op0, %op1
; CHECK: %sub = sub <16 x i32> %op2, %mul
  %mul = mul <16 x i32> %op0, %op1
  %sub = sub <16 x i32> %op2, %mul
  ret <16 x i32> %sub
}

define <16 x i32> @test_mul_rsub_i32(<16 x i32> %op0, <16 x i32> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_rsub_i32
; CHECK: %mul = mul <16 x i32> %op0, %op1
; CHECK: %sub = sub <16 x i32> %mul, %op2
  %mul = mul <16 x i32> %op0, %op1
  %sub = sub <16 x i32> %mul, %op2
  ret <16 x i32> %sub
}

define <16 x i32> @test_mul_add_i16_zext(<16 x i16> %op0, <16 x i16> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_add_i16_zext
; CHECK: [[MAD:%[^ ]+]] = call <16 x i32> @llvm.genx.uumad.v16i32.v16i16(<16 x i16> %op0, <16 x i16> %op1, <16 x i32> %op2)
  %ext0 = zext <16 x i16> %op0 to <16 x i32>
  %ext1 = zext <16 x i16> %op1 to <16 x i32>
  %mul = mul <16 x i32> %ext0, %ext1
  %add = add <16 x i32> %op2, %mul
  ret <16 x i32> %add
}

define <16 x i32> @test_mul_add_i16_sext(<16 x i16> %op0, <16 x i16> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_add_i16_sext
; CHECK: [[MAD:%[^ ]+]] = call <16 x i32> @llvm.genx.ssmad.v16i32.v16i16(<16 x i16> %op0, <16 x i16> %op1, <16 x i32> %op2)
  %ext0 = sext <16 x i16> %op0 to <16 x i32>
  %ext1 = sext <16 x i16> %op1 to <16 x i32>
  %mul = mul <16 x i32> %ext0, %ext1
  %add = add <16 x i32> %op2, %mul
  ret <16 x i32> %add
}

define <16 x i32> @test_mul_add_i16_szext(<16 x i16> %op0, <16 x i16> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_add_i16_szext
; CHECK: [[MAD:%[^ ]+]] = call <16 x i32> @llvm.genx.sumad.v16i32.v16i16(<16 x i16> %op0, <16 x i16> %op1, <16 x i32> %op2)
  %ext0 = sext <16 x i16> %op0 to <16 x i32>
  %ext1 = zext <16 x i16> %op1 to <16 x i32>
  %mul = mul <16 x i32> %ext0, %ext1
  %add = add <16 x i32> %op2, %mul
  ret <16 x i32> %add
}

define <16 x i32> @test_mul_add_i16_zsext(<16 x i16> %op0, <16 x i16> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_add_i16_zsext
; CHECK: [[MAD:%[^ ]+]] = call <16 x i32> @llvm.genx.usmad.v16i32.v16i16(<16 x i16> %op0, <16 x i16> %op1, <16 x i32> %op2)
  %ext0 = zext <16 x i16> %op0 to <16 x i32>
  %ext1 = sext <16 x i16> %op1 to <16 x i32>
  %mul = mul <16 x i32> %ext0, %ext1
  %add = add <16 x i32> %op2, %mul
  ret <16 x i32> %add
}

define <16 x i32> @test_mul_add_i16_zext_op0(<16 x i16> %op0, <16 x i32> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_add_i16_zext_op0
; CHECK: %ext0 = zext <16 x i16> %op0 to <16 x i32>
; CHECK: %mul = mul <16 x i32> %ext0, %op1
; CHECK: %add = add <16 x i32> %op2, %mul
  %ext0 = zext <16 x i16> %op0 to <16 x i32>
  %mul = mul <16 x i32> %ext0, %op1
  %add = add <16 x i32> %op2, %mul
  ret <16 x i32> %add
}

define <16 x i32> @test_mul_add_i16_sext_op0(<16 x i16> %op0, <16 x i32> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_add_i16_sext_op0
; CHECK: %ext0 = sext <16 x i16> %op0 to <16 x i32>
; CHECK: %mul = mul <16 x i32> %ext0, %op1
; CHECK: %add = add <16 x i32> %op2, %mul
  %ext0 = sext <16 x i16> %op0 to <16 x i32>
  %mul = mul <16 x i32> %ext0, %op1
  %add = add <16 x i32> %op2, %mul
  ret <16 x i32> %add
}

define <16 x i32> @test_mul_add_i16_sext_op1(<16 x i32> %op0, <16 x i16> %op1, <16 x i32> %op2) {
; CHECK-LABEL: @test_mul_add_i16_sext_op1
; CHECK: %ext1 = sext <16 x i16> %op1 to <16 x i32>
; CHECK: %mul = mul <16 x i32> %op0, %ext1
; CHECK: %add = add <16 x i32> %op2, %mul
  %ext1 = sext <16 x i16> %op1 to <16 x i32>
  %mul = mul <16 x i32> %op0, %ext1
  %add = add <16 x i32> %op2, %mul
  ret <16 x i32> %add
}