File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -1257,8 +1257,10 @@ bool GenXPatternMatch::matchFloatAbs(BinaryOperator *I) {
1257
1257
return false ;
1258
1258
1259
1259
uint64_t SplatV = 0 ;
1260
-
1261
- if (auto *C = dyn_cast<ConstantData>(I->getOperand (1 ))) {
1260
+ auto *Op = I->getOperand (1 );
1261
+ if (auto *C = dyn_cast<ConstantInt>(Op)) {
1262
+ SplatV = C->getZExtValue ();
1263
+ } else if (auto *C = dyn_cast<ConstantData>(Op)) {
1262
1264
auto *Splat = dyn_cast_or_null<ConstantInt>(C->getSplatValue ());
1263
1265
if (!Splat)
1264
1266
return false ;
Original file line number Diff line number Diff line change
1
+ ;=========================== begin_copyright_notice ============================
2
+ ;
3
+ ; Copyright (C) 2021-2024 Intel Corporation
4
+ ;
5
+ ; SPDX-License-Identifier: MIT
6
+ ;
7
+ ;============================ end_copyright_notice =============================
8
+
9
+ ; RUN: %opt %use_old_pass_manager% -GenXPatternMatch --enable-bfn=true \
10
+ ; RUN: -march=genx64 -mcpu=XeHPC -mtriple=spir64-unknown-unknown -S < %s | FileCheck %s
11
+
12
+ ; Test verifies that there will be no asserts here
13
+ ; CHECK-LABEL: internal spir_func float @and_absf
14
+ define internal spir_func float @and_absf (float %0 ) {
15
+ ; CHECK: call float @llvm.genx.absf.f32
16
+ %.cast = bitcast float 1 .000000e+00 to i32
17
+ %2 = and i32 %.cast , 2147483647
18
+ %.cast22 = bitcast i32 %2 to float
19
+ ret float %.cast22
20
+ }
You can’t perform that action at this time.
0 commit comments