2023-09-20 13:34:50 +08:00
|
|
|
# Different cases for using boolean variables in boolean contexts.
|
|
|
|
# Tests whether all boolean variables (expressed as i8s) are lowered into i1s before used in branching instruction (`br`)
|
|
|
|
|
|
|
|
def bfunc(b: bool) -> bool:
|
2023-10-30 17:19:18 +08:00
|
|
|
return not b
|
2023-09-20 13:34:50 +08:00
|
|
|
|
|
|
|
def run() -> int32:
|
2023-10-30 17:19:18 +08:00
|
|
|
b1 = True
|
|
|
|
b2 = False
|
2023-09-20 13:34:50 +08:00
|
|
|
|
2023-10-30 17:19:18 +08:00
|
|
|
if b1:
|
|
|
|
pass
|
2023-09-20 13:34:50 +08:00
|
|
|
|
2023-10-30 17:19:18 +08:00
|
|
|
if not b2:
|
|
|
|
pass
|
2023-09-20 13:34:50 +08:00
|
|
|
|
2023-10-30 17:19:18 +08:00
|
|
|
while b2:
|
|
|
|
pass
|
2023-09-20 13:34:50 +08:00
|
|
|
|
2023-10-30 17:19:18 +08:00
|
|
|
l = [i for i in range(10) if b2]
|
2023-09-20 13:34:50 +08:00
|
|
|
|
2023-10-30 17:19:18 +08:00
|
|
|
b_and = True and False
|
|
|
|
b_or = True or False
|
2023-09-20 13:34:50 +08:00
|
|
|
|
2023-10-30 17:19:18 +08:00
|
|
|
b_and = b1 and b2
|
|
|
|
b_or = b1 or b2
|
2023-09-20 13:34:50 +08:00
|
|
|
|
2023-10-30 17:19:18 +08:00
|
|
|
bfunc(b1)
|
2023-09-20 13:34:50 +08:00
|
|
|
|
2023-10-30 17:19:18 +08:00
|
|
|
return 0
|