1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=mergefunc < %s | FileCheck %s
4 define internal <2 x i32> @test1(<2 x i32> %v1, <2 x i32> %v2) {
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]]
9 %x = shufflevector <2 x i32> %v1, <2 x i32> %v2, <2 x i32> <i32 0, i32 1>
14 define 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>
19 ; Different mask than test1, don't merge.
20 define 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]]
25 %x = shufflevector <2 x i32> %v1, <2 x i32> %v2, <2 x i32> <i32 1, i32 0>
29 define 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
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)