1; RUN: llc -mtriple=xtensa -O1 -verify-machineinstrs < %s \ 2; RUN: | FileCheck %s -check-prefix=XTENSA 3 4; Check placement of first 6 arguments in registers and 7th argument on stack 5define dso_local i32 @test1(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr nocapture noundef readonly byval(i32) align 4 %6) { 6; XTENSA-LABEL: @test1 7; XTENSA: add a8, a7, a2 8; XTENSA: l32i a9, a1, 0 9; XTENSA: add a2, a8, a9 10; XTENSA: ret 11 %8 = load i32, ptr %6, align 4 12 %9 = add nsw i32 %5, %0 13 %10 = add nsw i32 %9, %8 14 ret i32 %10 15} 16 17; Check placement of second i64 argument in registers 18define dso_local i32 @test2(i32 noundef %0, i64 noundef %1, i32 noundef %2) { 19; XTENSA-LABEL: @test2 20; XTENSA: add a8, a6, a2 21; XTENSA: add a2, a8, a4 22; XTENSA: ret 23 %4 = trunc i64 %1 to i32 24 %5 = add nsw i32 %2, %0 25 %6 = add nsw i32 %5, %4 26 ret i32 %6 27} 28 29; Check placement of first argument typeof i8 in register 30define dso_local i32 @test3(i8 noundef signext %0, i64 noundef %1, i32 noundef %2) { 31; XTENSA-LABEL: @test3 32; XTENSA: add a8, a2, a6 33; XTENSA: add a2, a8, a4 34; XTENSA: ret 35 %4 = trunc i64 %1 to i32 36 %5 = sext i8 %0 to i32 37 %6 = add nsw i32 %5, %2 38 %7 = add nsw i32 %6, %4 39 ret i32 %7 40} 41 42; Check placement of 4th argument typeof i64 on stack 43define dso_local i32 @test4(i8 noundef signext %0, i64 noundef %1, i32 noundef %2, ptr nocapture noundef readonly byval(i64) align 8 %3) { 44; XTENSA-LABEL: @test4 45; XTENSA: add a8, a2, a6 46; XTENSA: add a8, a8, a4 47; XTENSA: l32i a9, a1, 0 48; XTENSA: add a2, a8, a9 49; XTENSA: ret 50 %5 = load i64, ptr %3, align 8 51 %6 = trunc i64 %1 to i32 52 %7 = trunc i64 %5 to i32 53 %8 = sext i8 %0 to i32 54 %9 = add nsw i32 %8, %2 55 %10 = add nsw i32 %9, %6 56 %11 = add nsw i32 %10, %7 57 ret i32 %11 58} 59 60; Check placement of 128 bit structure on registers 61define dso_local i32 @test5([4 x i32] %0, i32 noundef %1) { 62; XTENSA-LABEL: @test5 63; XTENSA: add a2, a2, a6 64; XTENSA: ret 65 %3 = extractvalue [4 x i32] %0, 0 66 %4 = add nsw i32 %3, %1 67 ret i32 %4 68} 69 70; Check placement of 128 bit structure on stack 71define dso_local i32 @test6(i32 noundef %0, [4 x i32] %1) { 72; XTENSA-LABEL: @test6 73; XTENSA: add a2, a3, a2 74; XTENSA: ret 75 %3 = extractvalue [4 x i32] %1, 0 76 %4 = add nsw i32 %3, %0 77 ret i32 %4 78} 79