}
define void @powi(double %V, double *%P) {
-entry:
%A = tail call double @llvm.powi.f64(double %V, i32 -1) nounwind
store volatile double %A, double* %P
}
define i32 @cttz(i32 %a) {
-entry:
+; CHECK-LABEL: @cttz(
+; CHECK-NEXT: ret i32 3
+;
%or = or i32 %a, 8
%and = and i32 %or, -8
%count = tail call i32 @llvm.cttz.i32(i32 %and, i1 true) nounwind readnone
ret i32 %count
-; CHECK-LABEL: @cttz(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: ret i32 3
}
define i8 @ctlz(i8 %a) {
-entry:
+; CHECK-LABEL: @ctlz(
+; CHECK-NEXT: ret i8 2
+;
%or = or i8 %a, 32
%and = and i8 %or, 63
%count = tail call i8 @llvm.ctlz.i8(i8 %and, i1 true) nounwind readnone
ret i8 %count
-; CHECK-LABEL: @ctlz(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: ret i8 2
}
define void @cmp.simplify(i32 %a, i32 %b, i1* %c) {
-entry:
%lz = tail call i32 @llvm.ctlz.i32(i32 %a, i1 false) nounwind readnone
%lz.cmp = icmp eq i32 %lz, 32
store volatile i1 %lz.cmp, i1* %c
store volatile i1 %pop1.cmp, i1* %c
ret void
; CHECK: @cmp.simplify
-; CHECK-NEXT: entry:
; CHECK-NEXT: %lz.cmp = icmp eq i32 %a, 0
; CHECK-NEXT: store volatile i1 %lz.cmp, i1* %c
; CHECK-NEXT: %tz.cmp = icmp ne i32 %a, 0
}
define i32 @ctlz_undef(i32 %Value) nounwind {
+; CHECK-LABEL: @ctlz_undef(
+; CHECK-NEXT: ret i32 undef
+;
%ctlz = call i32 @llvm.ctlz.i32(i32 0, i1 true)
ret i32 %ctlz
-; CHECK-LABEL: @ctlz_undef(
-; CHECK-NEXT: ret i32 undef
}
define i32 @cttz_undef(i32 %Value) nounwind {
+; CHECK-LABEL: @cttz_undef(
+; CHECK-NEXT: ret i32 undef
+;
%cttz = call i32 @llvm.cttz.i32(i32 0, i1 true)
ret i32 %cttz
-; CHECK-LABEL: @cttz_undef(
-; CHECK-NEXT: ret i32 undef
}
define i32 @ctlz_select(i32 %Value) nounwind {
+; CHECK-LABEL: @ctlz_select(
+; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.ctlz.i32(i32 %Value, i1 false)
+; CHECK-NEXT: ret i32 [[TMP1]]
+;
%tobool = icmp ne i32 %Value, 0
%ctlz = call i32 @llvm.ctlz.i32(i32 %Value, i1 true)
%s = select i1 %tobool, i32 %ctlz, i32 32
ret i32 %s
-; CHECK-LABEL: @ctlz_select(
-; CHECK-NEXT: call i32 @llvm.ctlz.i32(i32 %Value, i1 false)
-; CHECK-NEXT: ret i32
}
define i32 @cttz_select(i32 %Value) nounwind {
+; CHECK-LABEL: @cttz_select(
+; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.cttz.i32(i32 %Value, i1 false)
+; CHECK-NEXT: ret i32 [[TMP1]]
+;
%tobool = icmp ne i32 %Value, 0
%cttz = call i32 @llvm.cttz.i32(i32 %Value, i1 true)
%s = select i1 %tobool, i32 %cttz, i32 32
ret i32 %s
-; CHECK-LABEL: @cttz_select(
-; CHECK-NEXT: call i32 @llvm.cttz.i32(i32 %Value, i1 false)
-; CHECK-NEXT: ret i32
}
-; CHECK-LABEL: @overflow_div_add(
-; CHECK: ret i1 false
define i1 @overflow_div_add(i32 %v1, i32 %v2) nounwind {
-entry:
+; CHECK-LABEL: @overflow_div_add(
+; CHECK-NEXT: ret i1 false
+;
%div = sdiv i32 %v1, 2
%t = call %ov.result.32 @llvm.sadd.with.overflow.i32(i32 %div, i32 1)
%obit = extractvalue %ov.result.32 %t, 1
ret i1 %obit
}
-; CHECK-LABEL: @overflow_div_sub(
-; CHECK: ret i1 false
define i1 @overflow_div_sub(i32 %v1, i32 %v2) nounwind {
-entry:
; Check cases where the known sign bits are larger than the word size.
+; CHECK-LABEL: @overflow_div_sub(
+; CHECK-NEXT: ret i1 false
+;
%a = ashr i32 %v1, 18
%div = sdiv i32 %a, 65536
%t = call %ov.result.32 @llvm.ssub.with.overflow.i32(i32 %div, i32 1)
ret i1 %obit
}
-; CHECK-LABEL: @overflow_mod_mul(
-; CHECK: ret i1 false
define i1 @overflow_mod_mul(i32 %v1, i32 %v2) nounwind {
-entry:
+; CHECK-LABEL: @overflow_mod_mul(
+; CHECK-NEXT: ret i1 false
+;
%rem = srem i32 %v1, 1000
%t = call %ov.result.32 @llvm.smul.with.overflow.i32(i32 %rem, i32 %rem)
%obit = extractvalue %ov.result.32 %t, 1
ret i1 %obit
}
-; CHECK-LABEL: @overflow_mod_overflow_mul(
-; CHECK-NOT: ret i1 false
define i1 @overflow_mod_overflow_mul(i32 %v1, i32 %v2) nounwind {
-entry:
+; CHECK-LABEL: @overflow_mod_overflow_mul(
+; CHECK-NEXT: [[REM:%.*]] = srem i32 %v1, 65537
+; CHECK-NEXT: [[T:%.*]] = call %ov.result.32 @llvm.smul.with.overflow.i32(i32 [[REM]], i32 [[REM]])
+; CHECK-NEXT: [[OBIT:%.*]] = extractvalue %ov.result.32 [[T]], 1
+; CHECK-NEXT: ret i1 [[OBIT]]
+;
%rem = srem i32 %v1, 65537
; This may overflow because the result of the mul operands may be greater than 16bits
; and the result greater than 32.
}
define void @cos(double *%P) {
-entry:
+; CHECK-LABEL: @cos(
+; CHECK-NEXT: store volatile double 1.000000e+00, double* %P, align 8
+; CHECK-NEXT: ret void
+;
%B = tail call double @llvm.cos.f64(double 0.0) nounwind
store volatile double %B, double* %P
ret void
-; CHECK-LABEL: @cos(
-; CHECK: store volatile double 1.000000e+00, double* %P
}
define void @sin(double *%P) {
-entry:
+; CHECK-LABEL: @sin(
+; CHECK-NEXT: store volatile double 0.000000e+00, double* %P, align 8
+; CHECK-NEXT: ret void
+;
%B = tail call double @llvm.sin.f64(double 0.0) nounwind
store volatile double %B, double* %P
ret void
-; CHECK-LABEL: @sin(
-; CHECK: store volatile double 0.000000e+00, double* %P
}
define void @floor(double *%P) {
-entry:
+; CHECK-LABEL: @floor(
+; CHECK-NEXT: store volatile double 1.000000e+00, double* %P, align 8
+; CHECK-NEXT: store volatile double -2.000000e+00, double* %P, align 8
+; CHECK-NEXT: ret void
+;
%B = tail call double @llvm.floor.f64(double 1.5) nounwind
store volatile double %B, double* %P
%C = tail call double @llvm.floor.f64(double -1.5) nounwind
store volatile double %C, double* %P
ret void
-; CHECK-LABEL: @floor(
-; CHECK: store volatile double 1.000000e+00, double* %P, align 8
-; CHECK: store volatile double -2.000000e+00, double* %P, align 8
}
define void @ceil(double *%P) {
-entry:
+; CHECK-LABEL: @ceil(
+; CHECK-NEXT: store volatile double 2.000000e+00, double* %P, align 8
+; CHECK-NEXT: store volatile double -1.000000e+00, double* %P, align 8
+; CHECK-NEXT: ret void
+;
%B = tail call double @llvm.ceil.f64(double 1.5) nounwind
store volatile double %B, double* %P
%C = tail call double @llvm.ceil.f64(double -1.5) nounwind
store volatile double %C, double* %P
ret void
-; CHECK-LABEL: @ceil(
-; CHECK: store volatile double 2.000000e+00, double* %P, align 8
-; CHECK: store volatile double -1.000000e+00, double* %P, align 8
}
define void @trunc(double *%P) {
-entry:
+; CHECK-LABEL: @trunc(
+; CHECK-NEXT: store volatile double 1.000000e+00, double* %P, align 8
+; CHECK-NEXT: store volatile double -1.000000e+00, double* %P, align 8
+; CHECK-NEXT: ret void
+;
%B = tail call double @llvm.trunc.f64(double 1.5) nounwind
store volatile double %B, double* %P
%C = tail call double @llvm.trunc.f64(double -1.5) nounwind
store volatile double %C, double* %P
ret void
-; CHECK-LABEL: @trunc(
-; CHECK: store volatile double 1.000000e+00, double* %P, align 8
-; CHECK: store volatile double -1.000000e+00, double* %P, align 8
}
define void @rint(double *%P) {
-entry:
+; CHECK-LABEL: @rint(
+; CHECK-NEXT: store volatile double 2.000000e+00, double* %P, align 8
+; CHECK-NEXT: store volatile double -2.000000e+00, double* %P, align 8
+; CHECK-NEXT: ret void
+;
%B = tail call double @llvm.rint.f64(double 1.5) nounwind
store volatile double %B, double* %P
%C = tail call double @llvm.rint.f64(double -1.5) nounwind
store volatile double %C, double* %P
ret void
-; CHECK-LABEL: @rint(
-; CHECK: store volatile double 2.000000e+00, double* %P, align 8
-; CHECK: store volatile double -2.000000e+00, double* %P, align 8
}
define void @nearbyint(double *%P) {
-entry:
+; CHECK-LABEL: @nearbyint(
+; CHECK-NEXT: store volatile double 2.000000e+00, double* %P, align 8
+; CHECK-NEXT: store volatile double -2.000000e+00, double* %P, align 8
+; CHECK-NEXT: ret void
+;
%B = tail call double @llvm.nearbyint.f64(double 1.5) nounwind
store volatile double %B, double* %P
%C = tail call double @llvm.nearbyint.f64(double -1.5) nounwind
store volatile double %C, double* %P
ret void
-; CHECK-LABEL: @nearbyint(
-; CHECK: store volatile double 2.000000e+00, double* %P, align 8
-; CHECK: store volatile double -2.000000e+00, double* %P, align 8
}