From 72af0dedf9e18911da65b9a5c4906689e868d9fc Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Mon, 8 Jun 2026 17:10:31 +0800 Subject: [legacy] Add functional and performance test suites --- rcc-legacy/tests/sysy_lvX/081_exgcd.sy | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rcc-legacy/tests/sysy_lvX/081_exgcd.sy (limited to 'rcc-legacy/tests/sysy_lvX/081_exgcd.sy') diff --git a/rcc-legacy/tests/sysy_lvX/081_exgcd.sy b/rcc-legacy/tests/sysy_lvX/081_exgcd.sy new file mode 100644 index 0000000..3abdbcf --- /dev/null +++ b/rcc-legacy/tests/sysy_lvX/081_exgcd.sy @@ -0,0 +1,22 @@ +int exgcd(int a,int b,int x[],int y[]) { + if(b == 0) { + x[0] = 1; + y[0] = 0; + return a; + } + else { + int r = exgcd(b, a % b, x, y); + int t = x[0]; + x[0] = y[0]; + y[0] = (t - a / b * y[0]); + return r; + } +} + +int main() { + int a = 7, b = 15, x[1] = {1}, y[1] = {1}; + exgcd(a, b, x, y); + x[0] = (x[0] % b + b) % b; + putint(x[0]); + return 0; +} \ No newline at end of file -- cgit v1.2.3