You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
543 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

source_filename = "if_test.sy"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@a = dso_local global i32 0, align 4
define dso_local i32 @main() {
store i32 10, i32* @a, align 4 ; 相当于a=10
%1 = load i32, i32* @a, align 4
%2 = icmp sgt i32 %1, 0 ; %2a和a比较
br i1 %2, label %3, label %5 ; %4代表真%6代表假
3:
%4 = load i32, i32* @a, align 4
ret i32 %4 ; 预测为真返回a
5:
ret i32 0 ; 返回0
}