• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -mergefunc < %s | FileCheck %s
3
4define internal <2 x i32> @test1(<2 x i32> %v1, <2 x i32> %v2) {
5; CHECK-LABEL: @test1(
6; CHECK-NEXT:    [[X:%.*]] = shufflevector <2 x i32> [[V1:%.*]], <2 x i32> [[V2:%.*]], <2 x i32> <i32 0, i32 1>
7; CHECK-NEXT:    ret <2 x i32> [[X]]
8;
9  %x = shufflevector <2 x i32> %v1, <2 x i32> %v2, <2 x i32> <i32 0, i32 1>
10  ret <2 x i32> %x
11}
12
13; Same mask as test1.
14define internal <2 x i32> @test2(<2 x i32> %v1, <2 x i32> %v2) {
15  %x = shufflevector <2 x i32> %v1, <2 x i32> %v2, <2 x i32> <i32 0, i32 1>
16  ret <2 x i32> %x
17}
18
19; Different mask than test1, don't merge.
20define internal <2 x i32> @test3(<2 x i32> %v1, <2 x i32> %v2) {
21; CHECK-LABEL: @test3(
22; CHECK-NEXT:    [[X:%.*]] = shufflevector <2 x i32> [[V1:%.*]], <2 x i32> [[V2:%.*]], <2 x i32> <i32 1, i32 0>
23; CHECK-NEXT:    ret <2 x i32> [[X]]
24;
25  %x = shufflevector <2 x i32> %v1, <2 x i32> %v2, <2 x i32> <i32 1, i32 0>
26  ret <2 x i32> %x
27}
28
29define void @caller(<2 x i32> %v1, <2 x i32> %v2) {
30; CHECK-LABEL: @caller(
31; CHECK-NEXT:    [[TMP1:%.*]] = call <2 x i32> @test1(<2 x i32> [[V1:%.*]], <2 x i32> [[V2:%.*]])
32; CHECK-NEXT:    [[TMP2:%.*]] = call <2 x i32> @test1(<2 x i32> [[V1]], <2 x i32> [[V2]])
33; CHECK-NEXT:    [[TMP3:%.*]] = call <2 x i32> @test3(<2 x i32> [[V1]], <2 x i32> [[V2]])
34; CHECK-NEXT:    ret void
35;
36  call <2 x i32> @test1(<2 x i32> %v1, <2 x i32> %v2)
37  call <2 x i32> @test2(<2 x i32> %v1, <2 x i32> %v2)
38  call <2 x i32> @test3(<2 x i32> %v1, <2 x i32> %v2)
39  ret void
40}
41